Option for Marking Target Codebase Files as Reviewed
The import Web UI and REST interface provide options to set the criteria needed to mark file target codebase files as reviewed.
Note:For this option, the import compares only those files in the import data file that are marked as reviewed with files in the target codebase.
By default, the import can mark an unreviewed file in the target codebase as reviewed only if a file in the import data file has the same MD5 and complete file path as the target file. For example, suppose a file marked as “unreviewed” in the target project codebase has a complete path of /ePortal-1.3/src/gettext.c. The import can mark this file as reviewed only if the import data file contains a file whose complete path is /ePortal-1.3/src/gettext.c and whose MD5 is the same as the MD5 of the file in the target project codebase.
However, you can set different import criteria for marking files in the target project codebase as reviewed, such as requiring that only partial paths or only MD5 values match or requiring that both MD5 values and partial paths match. For more details, see the following topics:
• | “Add Files to Inventory” Option in the Web UI |
• | markFilesAsReviewed Attribute in the REST Interface |
“Mark Files as Reviewed” Option in the Web UI
The field Mark Files as Reviewed on the Import Project Data dialog is used to set the file-matching criteria for marking target codebase files as reviewed during the import process. For a description of the criteria options available with this field, see Import Project Data Dialog. For complete instructions on using the Web UI to import project data, see Importing Project Data Using the Web UI.
markFilesAsReviewed Attribute in the REST Interface
The markFilesAsReviewed attribute is used in the Import Project Data REST API to set the file-matching criteria for marking target codebase files as reviewed during the import process. The following sections provide attribute details:
• | About the “markFilesAsReviewed” Attribute |
• | Example “markFilesAsReviewed” Syntax in Import cURL Command |
For instructions on executing Import Project Data API, see Importing Project Data Using the REST API.
About the “markFilesAsReviewed” Attribute
The markFilesAsReviewed attribute must be set to true to enable the import process to mark reviewed files in the import data file as reviewed in the target project. Along with this attribute, a second attribute, reviewFileMatchingCritieria, must be included to set the file-matching criteria used to determine whether a given unreviewed file in the target codebase can be flagged as “Reviewed”. A third attribute is required to set the directory depth if you specify partial-path criteria. For more information about setting file-matching criteria, see Specifying File-Matching Criteria in the Import REST Interface.
If the user explicitly sets the markFilesAsReviewed attribute to false (or omits this attribute entirely), the import does not change the “Reviewed” or “Not Reviewed” status of files in the target project codebase. The statuses remain as they were before the import process was performed.
Example “markFilesAsReviewed” Syntax in Import cURL Command
The following shows an example of the explicit use of the markFilesAsReviewed attribute in a cURL command that calls the REST import endpoint:
curl -H "Authorization:Bearer %jwt%" -F importFile=@"FileToImport.zip" -F projectImportModel={ "createEmptyInventory” : true, “overwriteInventoryNotes” : true, “addFilesToInventory” : true, “inventoryFileMatchingCriteria” : “MD5_AND_PARTIAL_FILEPATH”, “inventoryDirectoryDepth” : 2, “markFilesAsReviewed” : true, “reviewFileMatchingCriteria” : “PARTIAL_FILEPATH”, “reviewDirectoryDepth” : 2, "resetInventoryUsage": false" };type=application/json http://hostname:8888/codeinsight/api/projects/{projectId}/import
For complete instructions about using the cURL command to execute an import, see Importing Project Data Using the REST API.
For more details about the implementation of the Import Project Data REST API, access the Code Insight Swagger documentation. To do so, click the icon in the upper right corner of the Code Insight Web UI, select Help, and click the REST API Guide link.