Create or update custom contract types
The /AddContractType command adds or updates custom contact types. Required contract types are defined using an XML file as specified below in this section.
Parameters
This command has the following parameter and flags.
Parameter |
Required / Optional | Description |
---|---|---|
/Definition | Required |
An XML file containing the definition of one or multiple contract types. See the paragraph below for the syntax of this file. |
/Update | Optional | Allows existing contract types to be extended. |
/Force | Optional | The /Force flag allows you to remove interfaces from existing contract types. This operation may break functionality and should not be performed in a production environment. |
The command fails if at least one of the new contract types already exists, unless you use the /Update flag. Updates are permitted only if new definitions extend the existing contract types.
Furthermore, if the contract type is in use by a contract with an instance association, then the update is only allowed if the instance supports the new interfaces. If this is not the case, first add the KCM Core scripts for the new interfaces, and then use /ProcessRegistrationFile command described in the Register or unregister an instance section to make sure that the added capabilities are recognized by the Contract Manager.
Contract types definition file
The XML file that defines one or more contract types has a structure like described below.
<?xml version="1.0" encoding="UTF-8"?>
<contracttypes formatversion="1">
<contracttype>
<name>MyContractType</name>
<version>1</version>
<type>core</type>
<interfaces>
<interface>
<name>MyOwnInterface</name>
<version>1</version>
</interface>
</interfaces>
</contracttype>
</contracttypes>
For this XML file:
- Always use “1” for the formatversion attribute.
- The file can contain one or more <contracttype> elements.
- The <name> and <version> elements of each <contracttype> identify the contract type. The name must be a valid XML element name, not exceeding 50 characters. It can only contain alphanumeric characters. The version must be an integer number.
- The
<type> of a
<contracttype> is either
core or
composeruihtml5. All interfaces in the contract type should be compatible with this type as follows:
- Core. Indicates that this contract type only contains interfaces for Core, Designer, or Administration.
- ComposerUIHtml5. Indicates that this contract type contains interfaces only for Core, Designer, Administration, or ComposerUI for HTML5.
- The <interface> elements define which interfaces are supported by the contract type.
- Each <interface> is identified by its own <name> and <version>.
Before a contract type is created, it is verified that each referenced interface exists and that the interface type is compatible with the type of the contract type.
Example
The following example demonstrates how to add the contract types from the file C:\Configuration\Types.xml.
ManageCM /AddContractType /Definition=C:\Configuration\Types.xml