Introduced in Feature Pack 2

Creating an extended content versioning configuration file

Introduced in Feature Pack 2 The content versioning configuration file tells you which UI objects are versionable, and how the system versions the UI object. In this lesson, you will learn how to create a custom content versioning configuration file for the corresponding Recipe objects.

About this task

Procedure

  1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
  2. In the Enterprise Explorer view, WC > xml > config > com.mycompany.commerce.project. The com.mycompany.commerce.project is the service module directory created in the previous Recipe tutorial.
  3. Create the content versioning configuration file.
    1. Right-click the com.mycompany.commerce.project folder, then click New > File.
    2. In the Name field, enter wc-content-version.xml.
    3. Click Finish. The wc-content-version.xml file opens.
  4. Copy the following code into the newly create configuration file.
    <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 ../xsd/wc-content-version.xsd">
    
    		 <wc:ContentVersionContainer name="com.mycompany.commerce.project" id="1">
    		 		 <wc:ContentVersionNoun name="Project" topTable="XPROJECT">
    		 		 		 <wc:ConfigGroup id="123">
    		 		 		 		 <wc:ContentVersionUIObject name="Recipe" />
    		 		 		 		 <wc:ContentVersionRelatedTable name="XPROJECT" values="${objectId}, ${storeId}" 
    		 		 		 		 		 whereClause="XPROJECT_ID =? AND STOREENT_ID = ?" />
    		 		 		 		 <wc:ContentVersionRelatedTable name="XPRJDES" 
    		 		 		 		 		 whereClause="XPROJECT_ID=?" values="${objectId}" />
    		 		 		 		 <wc:ContentVersionRelatedTable name="XPRJMTR" 
    		 		 		 		 		 whereClause="XPROJECT_ID=?" values="${objectId}" keyColumns="XPRJMTR_ID" />
    		 		 		 		 <wc:ContentVersionRelatedTable name="XPRJMTRDES" values="${XPRJMTR_ID}"
    		 		 		 		 		 whereClause="XPRJMTR_ID in (?)" keyColumns="XPRJMTR_ID" />
    		 		 		 		 <wc:ContentVersionRelatedTable name="XPRJMTRCATREL" values="${XPRJMTR_ID}, ${storeId}"
    		 		 		 		 		 whereClause="XPRJMTR_ID in (?) and STOREENT_ID = ?" keyColumns="XPRJMTR_ID" />
    		 		 		 		 <wc:ContentVersionRelatedTable name="XPRJINS"
    		 		 		 		 		 whereClause="XPROJECT_ID=?" values="${objectId}" keyColumns="XPRJINS_ID" />
    		 		 		 		 <wc:ContentVersionRelatedTable name="XPRJINSDES"
    		 		 		 		 		 values="${XPRJINS_ID}"
    		 		 		 		 		 whereClause="XPRJINS_ID in (?)" keyColumns="XPRJINS_ID" />
    		 		 		 		 <wc:ContentVersionRelatedTable name="XPRJCATREL"
    		 		 		 		 		 whereClause="XPROJECT_ID=? AND STOREENT_ID=?" values="${objectId}, ${storeId}" />
    		 		 		 </wc:ConfigGroup>
    		 		 </wc:ContentVersionNoun>
    		 		 <wc:ContentVersionNoun name="ProjectCollection" topTable="XPRJCOL">
    		 		 		 <wc:ConfigGroup id="234">
    		 		 		 		 <wc:ContentVersionUIObject name="RecipeCollection" />
    		 		 		 		 <wc:ContentVersionRelatedTable name="XPRJCOL"
    		 		 		 		 		 whereClause="XPRJCOL_ID=? AND STOREENT_ID=?" values="${objectId}, ${storeId}" />
    		 		 		 		 <wc:ContentVersionRelatedTable name="XPRJCOLDES"
    		 		 		 		 		 whereClause="XPRJCOL_ID=?" values="${objectId}" />
    		 		 		 		 <wc:ContentVersionRelatedTable name="XPRJPRJCOLREL"
    		 		 		 		 		 whereClause="XPRJCOL_ID=? AND STOREENT_ID=?" values="${objectId}, ${storeId}" />
    		 		 		 </wc:ConfigGroup>
    		 		 </wc:ContentVersionNoun>
    		 </wc:ContentVersionContainer>
    </wc:ContentVersionConfiguration>
    Note:
    • The wc:ContentVersionContainer element is the root element of the content versioning configuration file. The wc:ContentVersionContainer element defines a container. Each service module must declare one container. A container contains all the configuration for the service module. Specify the following attributes for this element:
      name
      The name of the container: com.mycompany.commerce.project.
      id
      An identifier for the container: Negative values are reserved for IBM use, while positive values can be used for customization
    • The wc.ContentVersionNoun element is used to define the configuration for the UI objects to be versioned for the specific noun. Specify the following attributes for this element:
      name
      The name of the noun: In the previous Recipe tutorial, the Project and ProjectCollection nouns were predefined for you. You can review the information by referring to this topic: Reviewing the Project noun.
      topTable
      This attribute defines which table contains the primary key of the UI objects being versioned. The topTable for the nouns Project and ProjectCollection is XPROJECT and XPRJCOL . You can review the corresponding information here: Defining the database schema.
      className
      The value of this attribute contains the name of the class that implements the content versioning service for this noun. If you do not specify this attribute, a default class is used.
      <wc:ContentVersionNoun name="ProjectCollection"
      			topTable="XPRJCOL">
    • The wc:ConfigGroup elements are used to create configuration groups. A configuration group is a group of objects that are versioned the same way. Specify the following attributes for this element:
      id
      The unique numeric identifier for this group. For example, Project and ProjectCollection are different object types but are versioned the same way.
      Configuration group ID for Project:
      <wc:ConfigGroup id="123">
      Configuration group ID for ProjectCollection:
      <wc:ConfigGroup id="234">
      name
      The name of the UI object as defined in Management Center.
      <wc:ContentVersionUIObject name="Recipe" />
      <wc:ContentVersionUIObject name="RecipeCollection" />
    • The wc:ContentVersionRelatedTable elements are used to define which tables are stored when creating a version of a UI object. Each UI object can have multiple tables that are stored when a version is created. Specify the following attributes for this element:
      name
      The name of the table to be stored. For example, XPROJECT, XPRJDES, and XPRJMTR. You can review the related table information defined in the previous Recipe tutorial in this topic: Defining the database schema.
      whereClause
      This attribute is used in the select statement. The system selects rows from the specified table based on the information provided in the whereClause attribute. Within the whereClause attribute, you use "?" symbol where you want to have the system replace the symbol with values specified in the values attribute.
      values
      The values of the corresponding parameter marks "?" in the whereClause. You can specify a literal value or use the following built-in variable in the values attribute:
      ${objectId}
      The primary key of the object you are versioning.
      ${storeId}
      The identifier of the store you are currently working on.
      ${storeOwnerId}
      The identifier of the member that owns the store.
      In this following sample code snippet, the system selects the primary key and store identifier rows from the XPROJECT table to be versioned.
      <wc:ContentVersionRelatedTable name="XPROJECT" values="${objectId}, ${storeId}" whereClause="XPROJECT_ID =? AND STOREENT_ID = ?" />
  5. Save your configuration file.

Results