Updating the content versioning configuration file

The content versioning configuration file defines the configuration for the UI objects that are versionable. To change the default configuration for versionable objects, you must extend the configuration file by creating a file in the ext folder.

The extended configuration file (wc-content-version.xml) must be placed in the following directory:
  • workspace_dir\WC\xml\config\com.ibm.commerce.servicemodule-ext\; where com.ibm.commerce.servicemodule-ext contains all the extended files for a particular service module.
Note: This file must contain only the custom changes.

Before you begin

  • Read Content Versioning configuration file (wc-content-version.xml) to understand the content versioning configuration file.
  • Open the wc-content-version.xml file in the workspace_dir\WC\xml\config\com.ibm.commerce.servicemodule directory or workspace_dir\WC\xml\config\com.ibm.commerce.servicemodule-fep directory for reference purposes. This file must not be modified. You will copy some XML elements from this file to your extended configuration file but only copy the lines that are required.
  • Ensure the custom tables you want to version exist in the base schema.

Procedure

  1. Open HCL Commerce Developer and switch to the Enterprise Explorer view.
  2. Create the ext folder for your extended configuration file if it does not exist.
    1. In the Enterprise Explorer view, expand WC > xml > config.
    2. Right-click the config folder; then click New > Folder.
    3. In the Name field, type com.ibm.commerce.servicemodule-ext;
      where com.ibm.commerce.servicemodule-ext contains all the custom files for the particular service module.
    4. Click Finish.
  3. In the ext folder, create the extended configuration file.
    1. Right-click the com.ibm.commerce.servicemodule-ext folder; then click New > File
    2. In the Name field, type wc-content-version.xml.
  4. Add the following code snippet into the custom configuration file:
    <?xml version="1.0" encoding="UTF-8"?>
    <wc:ContentVersionConfiguration xmlns:wc="http://www.ibm.com/xmlns/prod/WebSphereCommerce"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.ibm.com/xmlns/prod/WebSphereCommerce ../../content-version/xsd/wc-content-version.xsd">
    All configuration files start with the preceding code snippet.
  5. Identify the opening wc:ContentVersionContainer element in the original configuration file.
    Copy this tag into your extended configuration file. For example, <wc:ContentVersionContainer name="com.ibm.commerce.catalog" id="-1">.
  6. Identify the wc:ContentVersionNoun element that you want to extend in the original configuration file.
    Copy the wc:ContentVersionNoun tag to your extended configuration file. You must not change the topTable and className attributes.

    For example, <wc:ContentVersionNoun name="CatalogEntry" topTable="CATENTRY" className="com.ibm.commerce.catalog.version.CatalogEntryContentVersionServiceImpl">.

  7. Copy the wc:ConfigGroup element, and change the value of the id attribute to a positive number.

    For example, <wc:ConfigGroup id="1">

    Note: Negative id attribute values are reserved for IBM use.
  8. Identify the UI objects you want to extend in the original configuration file. Copy all of the child UI object (wc:ContentVersionUIObject) tags to your extended configuration file.

    For example, <wc:ContentVersionUIObject name="Product" />

  9. If you want to override the existing wc:ContentVersionRelatedTable configuration, copy over the tag and change as needed. Ensure that the name attribute value remains the same.
    If you modify the value of the whereClause attribute, the system uses this entry instead of the entry in the original configuration file.
    Note: Only copy over the wc:ContentVersionRelatedTable tags you want to modify. The system automatically merges the contents of both configuration files.
  10. If you want to add a new table to be included when versioning, create a wc:ContentVersionRelatedTable element for it.
    Ensure that you provide the following attributes:
    name
    The name of the table to store when versioning.
    whereClause
    This attribute is used in the select statement. Specifies which rows of the table to include when creating a version.
    values
    Specify comma-separated values that correspond to the question marks in the whereClause attribute value.
    keyColumns
    Specify this attribute to identify which columns of the table to use as key if the table does not have a primary key.
    enabled
    A value of true indicates that this entry is parsed by the configuration parser. A value of false indicates that this entry is ignored.
  11. Close the wc:ConfigGroup element with a </wc:ConfigGroup> tag.
  12. Close the wc:ContentVersionNoun element with a </wc:ContentVersionNoun> tag.
  13. Close the wc:ContentVersionContainer element with a </wc:ContentVersionContainer> tag.
  14. Close the element with a </wc:ContentVersionConfiguration> tag.
    The following code snippet shows you an extended configuration file that configures versioning for the additional custom tables (WARRANTY and XCAREINSTRUCTION) of the CatalogEntry noun.
    <?xml version="1.0" encoding="UTF-8"?>
    <wc:ContentVersionConfiguration xmlns:wc="http://www.ibm.com/xmlns/prod/WebSphereCommerce" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.ibm.com/xmlns/prod/WebSphereCommerce ../../content-version/xsd/wc-content-version.xsd">
    	<wc:ContentVersionContainer name="com.ibm.commerce.catalog" id="-1">
    		<wc:ContentVersionNoun name="CatalogEntry" topTable="CATENTRY" className="com.ibm.commerce.catalog.version.CatalogEntryContentVersionServiceImpl">
    			<wc:ConfigGroup id="-1">
       				<wc:ContentVersionUIObject name="Product" />
    				<wc:ContentVersionRelatedTable name=" XWARRANTY" whereClause="CATENTRY_ID=?" values="${objectId}"/>
       				<wc:ContentVersionRelatedTable name=" XCAREINSTRUCTION" whereClause="CATENTRY_ID=?" values="${objectId}"/>
    			</wc:ConfigGroup>
    		</wc:ContentVersionNoun>
    	</wc:ContentVersionContainer>
    </wc:ContentVersionConfiguration>
  15. Save and close the extended configuration file.