Skip to main content
Kinetic Community

Import Service Item

This command will import a service item given a KURL definition file.

Details

This command takes a single KURL definition file and evaluates the KURL code within.  This means that it is not actually limited to building a single service item, multiple service items can be defined in the same definition file.  In most cases though each definition  file contains a single service item.

Normally when building a service item, if a service item with the same name already exists within the same catalog it will be skipped. This behavior can be changed by adding the update, archive, or overwrite flag to configure KURL to run in update, archive, or overwrite mode.

Update

In update mode, if there is an existing service item with the same name and catalog that service item will be overwritten with the new one but answer data will be retained.  This is done by deleting all of the service item related data except for the service item record itself and the question records (which the answer records are related to).  While building the new service item all of the records are created normally except for service item and question records, in which case the records are just updated to match the new specification.  Because the service item and question records were only updated, not deleted and re-created, the answer data related to them is not lost and it remains related to the newly built service item. 

In update mode, if questions exist on the new service item and do not on the existing service item they will simply be added during the build process.

WARNING:  In update mode, if questions are present on the existing service item and are not defined in the new service item they will be deleted during the build process.  If questions to delete are found, you will be prompted as to whether you want to continue or not; the questions to delete will be listed as well.  If you wish to continue and delete these questions during the build process enter YES, anything else will cancel the build process.

Finally, in update mode, if questions to add and questions to delete are found the build process will be cancelled.  This means that if you wish to update a service item by adding questions and removing questions it must be done in two separate steps.

Archive

In archive mode, if there is an existing service item with the same name and catalog that service item will be renamed with a timestamp and the new service item will be created as normal.  The timestamp added is the integer number of seconds since epoch.

Also note that this timestamp adds 10 characters to the length of the service item name and the maximum name length is 50 characters.  Therefore if we try to archive a service item with a name longer than 40 characters we will encounter an error.

Overwrite

In overwrite mode, if there is an existing service item with the same name and catalog that service item will be DELETED and the new service item will be created as normal.

Arguments

file Specifies the file that contains a KURL definition to be imported.  This argument is required.
archive If used KURL will run in archive mode as described above
update If used KURL will run in update mode as described above
overwrite If used KURL will run in overwrite mode as described above
force If used KURL will not prompt for user approval before continuing with dangerous actions.

Examples

java -jar kurl.jar -action=build_service_item -file="definition.rb"

This command will build from a definition file named definition.rb.

If you want to use one of the Arguments described above you would add the Argument to the end of the Syntax.  Therefore if you want to run the update your syntax would be:

java -jar kurl.jar -action=build_service_item -file="definition.rb" -update