Develop > Business logic layer > Workspaces support for BOD service modules > Change control metadata for business objects in workspaces > Enable workspaces support for a custom table in an existing WebSphere Commerce BOD service module


Enable change control for a noun part

In cases where the noun can be divided into parts that can be independently modified, the change control information can also be independent. Part mediators can be registered to change control mediators that manage the noun part.


Before you begin

  1. Enable workspaces support for a custom table in an existing WebSphere Commerce BOD service module

  2. Enable change control for a noun

A changed noun part will inherit the change control information of its parent noun by default. However, if that part has been explicitly configured to have independent change control, then a separate CMMETADATA record is used to managed change control information for that part of the noun.

To configure change control on a specific part of a noun:


Procedure

  1. Launch WebSphere Commerce Developer.

  2. Identify the business object mediator configuration file where we will configure this noun part. In most cases, we will have already created the file following the steps in Enable change control for a noun. However, if you are enabling additional change control for a noun part that is part of a default WebSphere Commerce noun that is already configured in default configuration files, create a new file for the extensions.

    1. Determine the correct location for the configuration file to work with, based on the following criteria:

      • If you are enabling change control for a noun part that is part of a default WebSphere Commerce service module, right-click on the WC\config\com.ibm.commerce.myservicemodulename-ext folder.

      • If you are enabling change control for a noun part that is part of a custom service module, right-click on the WC\config\com.ibm.commerce.myservicemodulename folder.

    2. If wc-business-object-mediator.xml does not already exist in that directory, select New > Other > XML > XML > Next. If the file already exists, proceed to the next step.

    3. Select Create an XML file from scratch.

    4. Click Next.

    5. Name the file: wc-business-object-mediator.xml.

    6. Click Finish.

  3. Mediators for a noun are defined within the <_config:object> element for the noun. In extensions to existing business object mediator configurations, we will need to copy over this element in order to add mediators for nouns and noun parts. In many customizations, this file (and the appropriate <_config:object> element) will already have been generated for you as part of running the Data Service Layer Wizard. You should never modify default WebSphere Commerce business object mediator configuration files, as they can be overwritten when you apply updates to WebSphere Commerce.

  4. Mediators for a noun part are defined within the <_config:mediator> element for the noun mediator. In extensions to existing business object mediator configurations, we will need to copy over this element in order to add mediators for noun parts. In many customizations, this file (and the appropriate <_config:mediator> element) will already have been generated for you as part of running the Data Service Layer Wizard.

  5. Add a <_config:part-mediator> element to the <_config:mediator> element. Set the interfaceName attribute to com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.BusinessObjectMediator. Because the part mediator implementation is coupled to the change control mediator implementation for the noun, there is no unique interface required.

    For example:

    <_config:part-mediator interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.BusinessObjectMediator">
    

  6. Create a <_config:part-mediator-implementation> element with a className of com.ibm.commerce.context.content.locking.ChangeControlBusinessObjectPartMediatorImpl. This is the part mediator implementation which the change control mediator is expecting and dependent on. Any change control part mediator must either be this class or a subclass of this class.

    For example:

            <_config:part-mediator-implementation className="com.ibm.commerce.context.content.locking.ChangeControlBusinessObjectPartMediatorImpl">
    

  7. Add a <_config:mediator-properties> element and, within it, <_config:mediator-property> elements for the part mediator implementation. An explanation of the values, and a sample set of configuration elements, are provided:

    objectPath

    A mandatory property that identifies the noun part you are applying change control to. The value is the XPath expression pointing to the noun part.

    uniqueIDProperty

    The property of the noun that resolves the identifier. Set this value to uniqueID. This is the value found in BOKEY1 column of the CMMETADATA table.

    resourceManagerId

    The resourceManagerId is a mandatory property which is the value used in the CMRESMGR_ID column of the CMMETADATA table. The resource manager ID must be a defined resource manager (which maps to a table) for the service module, found in one of the following files:

    • workspace_dir\wc\xml\content-management\ servicemodulename.resource-managers.xml

    • WC_INSTALL\wc.ear\xml\content-management\servicemodulename.resource-managers.xml

    • workspace_dir\wc\xml\content-management\servicemodulename.resource-managers-ext.xml

    • WC_INSTALL\wc.ear\xml\content-management\servicemodulename.resource-managers-ext.xml

    You define the resourceManagerId when you perform the steps in Enable workspaces support for a custom table in an existing WebSphere Commerce BOD service module.

    The following code sample shows a complete definition:

                
    <_config:mediator-properties>                  <_config:mediator-property name="objectPath" value="Association"/>                  <_config:mediator-property name="uniqueIDProperty" value="uniqueID"/>                  <_config:mediator-property name="resourceManagerId" value="18"/>             
    </_config:mediator-properties>
    

  8. Optional: Additional properties of the change control part mediation can be specified:

    1. A uniqueIDProperty can be specified to indicate the property of the object that indicates the value that is stored in the BOKEY2 column of the CMMETADATA table. Specify this property if the object property is a list and each list item has separate change control information associated with it. If the entire list shares the same change control information, then this property is not required.

    2. A resourceContainerId property can be specified on the change control part mediation implementation if the CMMETADATA record should use a different resource container than the one used for the noun. If this property is not specified, then the resourceContainerId of the noun is used.


Example

The following XML sample shows a change control mediator that includes identifying individual noun parts that will have change control managed independently of the noun. This example demonstrates dividing the CatalogGroup noun into three change control parts. The NavigationRelationship and Association have been identified as separate change control parts and the rest will inherit the change control of the CatalogGroup noun. The change control for the Association also includes a uniqueIDProperty which means that each Association instance is individually managed.

<_config:mediator className="com.ibm.commerce.context.content.locking.ChangeControlBusinessObjectMediatorImpl" 
interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.ChangeControlBusinessObjectMediator">     <_config:mediator-properties>         <_config:mediator-property name="uniqueIDProperty" value="CatalogGroupIdentifier/UniqueID"/>         <_config:mediator-property name="resourceManagerIds" value="3"/>         <_config:mediator-property name="resourceContainerId" value="3"/>     </_config:mediator-properties>     <_config:part-mediator interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.BusinessObjectMediator">         <!--  Associations - Individually Lockable -->         <_config:part-mediator-implementation className="com.ibm.commerce.context.content.locking.ChangeControlBusinessObjectPartMediatorImpl">             
<_config:mediator-properties>                  <_config:mediator-property name="objectPath" value="Association"/>                  <_config:mediator-property name="uniqueIDProperty" value="uniqueID"/>                  <_config:mediator-property name="resourceManagerId" value="18"/>             
</_config:mediator-properties>         </_config:part-mediator-implementation>         <!--  Navigation Relationships - Individually Lockable -->         <_config:part-mediator-implementation className="com.ibm.commerce.context.content.locking.ChangeControlBusinessObjectPartMediatorImpl">             
<_config:mediator-properties>                  <_config:mediator-property name="objectPath" value="NavigationRelationship"/>                  <_config:mediator-property name="resourceManagerId" value="5"/>             
</_config:mediator-properties>         </_config:part-mediator-implementation>     </_config:part-mediator>
</_config:mediator>


Related concepts

Workspaces support for BOD service modules

Use authoring access profiles with workspaces

Workspaces support and the Business Context Service

Change control metadata for business objects in workspaces


Related tasks

Call a service with a workspace context from a Java based client or JUnit testcase

Related reference

Change control metadata structure for business objects

Business context service parameters for business object documents


+

Search Tips   |   Advanced Search