Available Import Options to Configure Import Behavior

FlexNet Code Insight 2020 R1

The following options can be specified to override the default import behavior described in the previous section.

Option to Require MD5 Checks When Associating Files to Target Inventory
Option to Require MD5 Checks When Marking Target Codebase Files as Reviewed
Option for Overwriting or Appending Inventory Notes
Option to Process and Create Empty Inventory

Much of this information directly applies to the procedures on how to execute an import using the Web UI or the REST interface described later in this chapter. However, because the configuration of import behavior is a thoughtful process and certain configurations must be performed before initiating an import, the configuration options are described here.

Option to Require MD5 Checks When Associating Files to Target Inventory

The import Web UI and REST interface provide an option to specify whether the file MD5 value, in addition to the file path, should be used as a criterion when associating files to inventory in the target project during the import process. When this option is disabled, only those files whose file paths match in both the import data file and the target project codebase are associated with inventory in the target project. For example, the file /ePortal-1.3/src/gettext.c, listed in the data file as belonging to “Inventory Item 1”, will be considered for association to this inventory item in the target project only if the scanned target project codebase contains the file /ePortal-1.3/src/gettext.c with the same file path.

When this option disabled, the criteria for adding files becomes more stringent since both the MD5 value and the file path must be considered. Only those files whose MD5 value and file path in the data file have a match in the target project codebase will be associated with inventory in the target project.

For more information about matching file paths, see Matching File Paths.

Option in the Web UI

This option is displayed as the Only add files to inventory with matching MD5 field on the Import Project dialog, used to start the import process. For complete import instructions, see Importing Project Data Using the Web UI.

The unchecked field disables the MD5 checks so that only the file-path checks are used for associating files with target inventory.
The checked field enables the MD5 checks along with the file-path checks for file associations.

By default, this field in unchecked in the Web UI.

Option in the REST Interface

The option is available as the checkInventory parameter for the importProjectData API. For complete instructions on using this API, see Importing Project Data Using the REST API.

If the checkInventory parameter is not explicitly included in the API syntax, its value defaults to false, meaning that the MD5-match requirement is disabled. With this configuration, only a matching file path is used as the criterion for associating files with target inventory.
To enable the use of MD5 checks along with file-path checks when associating files with inventory in the target project, explicitly include the checkInventory=true parameter as shown:

curl -X POST --data-binary "@PROJECT_DATA_FILE.zip" "HOST:PORT/codeinsight/api/importer/importProjectData?projectId=PROJECT_ID&checkInventory=true"

Option to Require MD5 Checks When Marking Target Codebase Files as Reviewed

The import Web UI and REST interface provide an option to specify whether the file MD5 value should be used as criteria (in addition to the file path) when marking codebase files as reviewed in the target project during the import process. When this option is enabled, files flagged as “reviewed” in the import data file are eligible for the “reviewed” flag in the scanned target project codebase only if their file path and MD5 value match in both the data file and the target project. For example, the file /ePortal-1.3/src/gettext.c, which is flagged as the “reviewed” in the data file, is eligible for the “reviewed” flag in the target project only if the target project codebase contains the file /ePortal-1.3/src/gettext.c with the same file path and MD5 value.

When this option is disabled, files flagged as “reviewed” in the import data file are eligible for the “reviewed” flag in the scanned target project codebase if their file paths match in both the data file and the target project. The MD5 value is not used as a criterion in this file-matching process.

For more information about matching file paths, see Matching File Paths.

Option in the Web UI

This option is displayed as the Only mark files as reviewed with matching MD5 field on the Import Project dialog, used to start the import process. For complete import instructions, see Importing Project Data Using the Web UI.

The unchecked field disables the MD5-match requirement for marking files as reviewed in the target project.
The checked field enables the MD5-match requirement along with the file-path requirement for marking files in the target codebase as reviewed.

By default, this field in unchecked in the Web UI.

Option in the REST Interface

This option is available as the checkReviewed parameter for the importProjectData API. For complete instructions on using this API, see Importing Project Data Using the REST API.

If you do not explicitly include the checkReviewed parameter in the API syntax, the parameter value defaults to true, meaning that the MD5-match requirement is enabled. A file in the target project is marked as reviewed only if its MD5 and file path match a reviewed file in the import data file.
To disable the use the MD5-match requirement (so that only a matching file path is required) when marking files as reviewed in the target project, explicitly include the checkReviewed=false parameter as shown:

curl -X POST --data-binary "@PROJECT_DATA_FILE.zip" "HOST:PORT/codeinsight/api/importer/importProjectData?projectId=PROJECT_ID&checkReviewed=false"

Option for Overwriting or Appending Inventory Notes

Two inventory items are considered identical between the source and target project if they are associated with the same Code Insight data library item (based on the unique combination of component-version-license, or CVL). The import Web UI and REST interface enable you to specify whether notes for an inventory item in the target project should be overwritten with notes from an identical inventory item in the source project. Alternatively, the notes from the source inventory are appended to existing notes in the target inventory. This option applies to the following inventory notes:

Notices Text
Audit Notes
Usage Guidance
Remediation Notes

Options in the Web UI

The selection of one of these options on the Import Project dialog configures the handling of inventory notes during the import process. For complete import instructions, see Importing Project Data Using the Web UI.

Overwrite existing notes with imported notes—Identical inventory is resolved during the import by overwriting all notes in the target inventory item with content from the import data file. However, empty data for a given field in the source target inventory will not overwrite existing content for that same field in the target inventory item (that is, the existing target content is retained). By default, this option is selected.
Append imported notes to existing notes—Notes from the source inventory item are appended at the end of any existing notes in the identical target inventory item. For a given note field, the appended content is separated from the existing content with a line break and the following heading:

Copied during import from <ProjectName>:<InventoryName> (TimeStamp) 

However, if note content for a given field is the same in both the source and the target inventory item, no content is appended in the field.

Option in the REST Interface

The option is available as the overwriteInventoryNotes parameter for the importProjectData API. For complete instructions on using this API, see Importing Project Data Using the REST API.

If you do not explicitly include the overwriteInventoryNotes parameter in the API syntax, the parameter value defaults to true, meaning that all notes in the target inventory item are overwritten with content from its identical source inventory item. However, empty data for a given field in the source inventory will not overwrite existing content for that same field in the target inventory item (that is, the existing target content is retained).
To append notes from the source inventory item to the end of the existing notes in the identical target inventory item, explicitly include the overwriteInventoryNotes=false parameter as shown:

curl -X POST --data-binary "@PROJECT_DATA_FILE.zip" "HOST:PORT/codeinsight/api/importer/importProjectData?projectId=PROJECT_ID&overwriteInventoryNotes=false"

For a given note field, the appended content is separated from the existing content with a line break and the following heading:

Copied during import from <ProjectName>:<InventoryName> (TimeStamp) 

However, if note content for a given field is the same in both the source and the target inventory item, no content is appended in the field.

Option to Process and Create Empty Inventory

The import Web UI and REST interface provide an option to specify whether “empty” system-generated inventory items are still processed in the target project during the import. Empty inventory items either have no file associations in the data file to be imported or do have associated files in the data file but no matching file paths for these files in the scanned target codebase (also see Matching File Paths).

When this option is enabled, all inventory items—with or without matching associated files in the target codebase—are created in the target project during the import.

When the option is disabled, the import process does not create empty inventory items in the target project. It creates only inventory items with matching associated files in the target codebase.

Note • Inventory items without file associations are never imported by default. If you are importing from a scanned project into an inventory-only project, which has no codebase, ensure this option is enabled so that inventory is generated in the new project.

Option in the Web UI

The option is displayed as the project setting, On the data import or rescan, delete inventory with no associated files, located on the Edit Project: General Tab. Ensure that this field is properly set for the import you are about to perform. (You can always reset this value for the project once the import is complete.) See Editing the Project Definition and General Settings for details. The setting values include the following:

The unchecked field enables the creation of empty inventory in the target project.
The checked field disables the creation of empty inventory in the target project. Only inventory with matching associated files in the target codebase are created.

The default for this setting is defined at a global level by the administrator.

Option in the REST interface

The option is available as the createEmpyInventory parameter for the importProjectData API. For complete instructions on using this API, see Importing Project Data Using the REST API.

If you do not explicitly include the createEmpyInventory parameter when invoking the importProjectData API, the import process uses the value of the deleteEmptyInventory setting defined for the project. (This setting is the same as the On the data import or rescan, delete inventory with no associated files value on the Edit Project: General Tab.) To override this project setting for the current import process only, explicitly include the createEmptyInventory parameter in the import command. See the next two bulleted items.
To enable the creation of empty inventory items in the target project, include createEmptyInventory=true, as in the following example:

curl -X POST --data-binary "@PROJECT_DATA_FILE.zip" "HOST:PORT/codeinsight/api/importer/importProjectData?projectId=PROJECT_ID&createEmptyInventory=true"

To disable the creation of empty inventory items in the target project, include createEmptyInventory=false parameter in the import command.