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.xmlfile 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
- Open HCL Commerce Developer and switch to the Enterprise Explorer view.
- Create the
extfolder for your extended configuration file if it does not exist. - In the
extfolder, create the extended configuration file.- Right-click the com.ibm.commerce.servicemodule-ext folder; then click
- In the Name field, type wc-content-version.xml.
- Add the following code snippet into the custom configuration
file:
All configuration files start with the preceding code snippet.<?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"> - Identify the opening
wc:ContentVersionContainerelement in the original configuration file.Copy this tag into your extended configuration file. For example,<wc:ContentVersionContainer name="com.ibm.commerce.catalog" id="-1">. - Identify the
wc:ContentVersionNounelement that you want to extend in the original configuration file.Copy thewc:ContentVersionNountag to your extended configuration file. You must not change thetopTableandclassNameattributes.For example,
<wc:ContentVersionNoun name="CatalogEntry" topTable="CATENTRY" className="com.ibm.commerce.catalog.version.CatalogEntryContentVersionServiceImpl">. - Copy the
wc:ConfigGroupelement, and change the value of theidattribute to a positive number.For example,
<wc:ConfigGroup id="1">Note: Negativeidattribute values are reserved for IBM use. - 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" /> - If you want to override the existing
wc:ContentVersionRelatedTableconfiguration, copy over the tag and change as needed. Ensure that thenameattribute value remains the same.If you modify the value of thewhereClauseattribute, the system uses this entry instead of the entry in the original configuration file.Note: Only copy over thewc:ContentVersionRelatedTabletags you want to modify. The system automatically merges the contents of both configuration files. - If you want to add a new table to be included when versioning,
create a
wc:ContentVersionRelatedTableelement 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
whereClauseattribute 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.
- Close the
wc:ConfigGroupelement with a</wc:ConfigGroup>tag. - Close the
wc:ContentVersionNounelement with a</wc:ContentVersionNoun>tag. - Close the
wc:ContentVersionContainerelement with a</wc:ContentVersionContainer>tag. - 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 theCatalogEntrynoun.<?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> - Save and close the extended configuration file.