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:
- WC_eardir\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 WC_eardir\xml\config\com.ibm.commerce.servicemodule directory or WC_eardir\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 WebSphere Commerce Developer and switch to the Enterprise Explorer view.
- Create the
ext
folder for your extended configuration file if it does not exist. - In the
ext
folder, 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: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">
. - Identify the
wc:ContentVersionNoun
element that you want to extend in the original configuration file.Copy thewc:ContentVersionNoun
tag to your extended configuration file. You must not change thetopTable
andclassName
attributes.For example,
<wc:ContentVersionNoun name="CatalogEntry" topTable="CATENTRY" className="com.ibm.commerce.catalog.version.CatalogEntryContentVersionServiceImpl">
. - Copy the
wc:ConfigGroup
element, and change the value of theid
attribute to a positive number.For example,
<wc:ConfigGroup id="1">
Note: Negativeid
attribute 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:ContentVersionRelatedTable
configuration, copy over the tag and change as needed. Ensure that thename
attribute value remains the same.If you modify the value of thewhereClause
attribute, the system uses this entry instead of the entry in the original configuration file.Note: Only copy over thewc:ContentVersionRelatedTable
tags 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: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.
- Close the
wc:ConfigGroup
element with a</wc:ConfigGroup>
tag. - Close the
wc:ContentVersionNoun
element with a</wc:ContentVersionNoun>
tag. - Close the
wc:ContentVersionContainer
element 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 theCatalogEntry
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>
- Save and close the extended configuration file.