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 Enterprise Explorer view, expand .
- Right-click the config folder;
then click .
- 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.
- Click Finish.
- 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:
<?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.
- 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
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">
.
- 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.
- 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 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.
- 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 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>
- Save and close the extended configuration file.