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

You can enable change control for a noun by registering a change control mediator for the noun. No Java coding is required. All change control uses a common change control mediator implementation which is provided for you by default. The data service layer uses the registration information and the change control mediator to validate whether the object can be modified, and to create locks when modifying the object.


Procedure

  1. Open WebSphere Commerce Developer.

  2. Create a business object mediator configuration file, if one does not already exist:

    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 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 that is part of a custom service module, right-click on the WC\config\com.mycompany.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 step 4.

    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 in 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 the noun. 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.

    Remember: 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. Create a <_config:mediator> element with a className of com.ibm.commerce.context.content.locking.ChangeControlBusinessObjectMediatorImpl and an interfaceName of com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.ChangeControlBusinessObjectMediator.

    For example:

    <_config:mediator className="com.ibm.commerce.context.content.locking.ChangeControlBusinessObjectMediatorImpl" 
    interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.ChangeControlBusinessObjectMediator">
    

  5. Create a set of <_config:mediator-property> elements for the change control mediator which indicates the resource container and manager ID used to represent this noun. An explanation of the values, and a sample set of configuration elements, are provided:

    uniqueIDproperty

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

    resourceManagerId and resourceContainerId

    You define the resource containers and managers when you perform the steps in Enable workspaces support for a custom table in an existing WebSphere Commerce BOD service module. The resource container ID and resource manager ID must be a defined resource container or resource manager for the service module, found in one of the following files:

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

    • WC_EAR\xml\content-management\servicemodulename.resource-managers.xml

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

    • WC_EAR\xml\content-management\servicemodulename.resource-managers-ext.xml

    The following example shows a noun registered with a value of 10001 for the resource container value and 1 for the resource manager value.

    <_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="StoreIdentifier/UniqueID"/>               <_config:mediator-property name="resourceManagerId" value="1"/>               <_config:mediator-property name="resourceContainerId" value="10001"/>           </_config:mediator-properties> 
    </_config:mediator>
    


Example

The following sample shows a complete configuration file containing change control mediators for the TutorialStoreType noun:

<_config:BusinessObjectMediatorConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../xsd/wc-business-object-mediator.xsd" xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config"> 
    <_config:object logicalType="com.mycompany.commerce.tutorialstore.facade.datatypes.TutorialStoreType" 
        physicalType="com.mycompany.commerce.tutorialstore.facade.server.entity.datatypes.Storeent"> 
     
<_config:mediator interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.ReadBusinessObjectMediator" 
            className="com.mycompany.commerce.tutorialstore.facade.server.services.dataaccess.bom.mediator.ReadTutorialStoreMediator">          
<_config:part-mediator interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.ReadBusinessObjectPartMediator">                         <_config:part-mediator-implementation className="com.mycompany.commerce.tutorialstore.facade.server.services.dataaccess.bom.mediator.ReadTutorialStoreDescriptionMediator"/>                         <_config:part-mediator-implementation className="com.mycompany.commerce.tutorialstore.facade.server.services.dataaccess.bom.mediator.ReadTutorialStoreSupportedLanguagesMediator"/>                         <_config:part-mediator-implementation className="com.mycompany.commerce.tutorialstore.facade.server.services.dataaccess.bom.mediator.ReadTutorialStoreSupportedCurrenciesMediator"/>          
</_config:part-mediator>         
</_config:mediator>      
<_config:mediator interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.ChangeBusinessObjectMediator" 
            className="com.mycompany.commerce.tutorialstore.facade.server.services.dataaccess.bom.mediator.ChangeTutorialStoreMediator">                  
<_config:part-mediator interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.ChangeBusinessObjectPartMediator">                           
<_config:part-mediator-implementation className="com.mycompany.commerce.tutorialstore.facade.server.services.dataaccess.bom.mediator.ChangeTutorialStoreDescriptionMediator"/>                           
<_config:part-mediator-implementation className="com.mycompany.commerce.tutorialstore.facade.server.services.dataaccess.bom.mediator.ChangeTutorialStoreBasePartMediator"/>             
</_config:part-mediator>      
</_config:mediator>       
     
<_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="StoreIdentifier/UniqueID"/>               <_config:mediator-property name="resourceManagerId" value="1"/>               <_config:mediator-property name="resourceContainerId" value="10001"/>           </_config:mediator-properties>      
</_config:mediator>       
    </_config:object>   
</_config:BusinessObjectMediatorConfiguration>


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