WebSphere Commerce EnterpriseWebSphere Commerce Professional

Enabling workspace support for the custom tables

In this lesson, you enable workspace support for your custom tables by creating an XML file to identify the table or tables that are managed.

About this task

One key aspect of enabling workspaces support is classifying your data as managed content assets or managed operational assets. The distinction between content and operational data is discussed in detail in the Workspaces data model. You need to understand whether the tables you want to manage using workspaces are content or operational before performing this task. The tables you are working with are all content managed. See Enabling workspaces support for a custom table in an existing WebSphere Commerce BOD service module for more information.

The XWARRANTY and XCAREINSTRUCTION schema is shown in the following diagram:


Schema diagram for the XWARRANTY and XCAREINSTRUCTION custom tables

Note the primary keys for the tables.

Procedure

  1. Create the following file to contain catalog workspace customizations:
    WC_eardir\xml\content-management\com.ibm.commerce.catalog.resource-managers-ext.xml
  2. Open the file in a text or XML editor, and add the following lines to begin the file:
    <wc:ResourceContainer 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-resource-managers.xsd">
    <wc:Definition id="10100" name="ExtendedCatalogResourceContainer" 
    className="com.ibm.commerce.context.content.resources.DSLResourceContainer">
    </wc:Definition> 

    The wc:Definition element defines the resource container used by the service module. All BOD service modules use className="com.ibm.commerce.context.content.resources.DSLResourceContainer" as shown in the example. The only value you should change from the sample XML is the id. The value of the id is a unique integer, not previously used by WebSphere Commerce, or other workspace customizations. IBM reserves values ranging from 1 to 9999. Use a value over 10000.

  3. To add workspace support for a content managed table, add the following sample code to your file:
    <wc:ManagedResources>
    	<wc:ManagedResource
    		id="10001"
    		name="XWARRANTY"
    		resource="XWARRANTY"
    		resourceClassName=""
    		resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager"
    		managed="true"
    		resourceKeys="CATENTRY_ID">
    	</wc:ManagedResource>
    	<wc:ManagedResource
    		id="10002"
    		name="XCAREINSTRUCTION"
    		resource="XCAREINSTRUCTION"
    		resourceClassName=""
    		resourceManagerClassName="com.ibm.commerce.context.content.resources.DSLResourceManager"
    		managed="true"
    		resourceKeys="CATENTRY_ID,LANGUAGE_ID">
    	</wc:ManagedResource>
    </wc:ManagedResources>
    Notes:
    • The resourceKeys attribute is the primary key of the table. For example resourceKeys="CATENTRY_ID,LANGUAGE_ID" represents the primary key of the XCAREINSTRUCTION table.
    • The resource container is the name of the container that defines the related resource. The resource container is listed in the definition element near the start of the file. For example:
      <wc:Definition id="10100" name="ExtendedCatalogResourceContainer" 
      className="com.ibm.commerce.context.content.resources.DSLResourceContainer">
      </wc:Definition> 
    • A <wc:ManagedResource> element is required for each content managed table.
    • The managed resource IDs are unique per resource container. However, for any cases where you are adding managed resources to an existing WebSphere Commerce resource container, it is recommended that you use values greater than 10000, to avoid all possible collisions.
    • The resourceClassName attribute is always set to an empty string for Data Service Layer based implementations. This attribute is only used by workspaces in WebSphere Commerce Accelerator.
  4. Close the file with the following lines:
    <wc:PublishRequest uniqueTransaction="false" />
    </wc:ResourceContainer>
    
    Note: The <wc:PublishRequest> element is used to indicate whether to keep the transactions for this whole file (the resource container) separate from all others when a workspace is published. If set to true, the transactions for this resourceContainer will be published separately. If set to false, transactions will be grouped for all resourceContainers.