Introduced in Feature Pack 2

Enabling content versioning for inherited Catalog objects

The content versioning feature is not enabled for inherited objects by default. You can enable this feature if you want to allow users to manage versions of inherited objects in extended site stores. Normally, you manage versions of objects in their parent asset store. If you modify parts of the inherited objects in the extended site store, you can manage versions of the inherited object in that store. For example, if you add merchandising associations to the inherited object in the extended site store, you can manage versions of the inherited object to include the associations.

Feature Pack 5 or laterSupport for content versioning for inherited objects is provided by default with WebSphere Commerce Feature Pack 5. The customization that is described in this topic is no longer required if you publish WebSphere Commerce Feature Pack 5 and enable versioning. For more information about enabling content versioning, see enabling content versioning in Management Center.

To enable content versioning for an inherited object, you modify the definitions file for the inherited object. The object definition file contains configuration information to display the business objects, and properties views in the Management Center. You also modify the WC_eardir\xml\config\com.ibm.commerce.catalog\wc-content-version.xml file to include the object to version.

Procedure

  1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.
  2. Update the content versioning configuration file to include the inherited catalog objects.
    1. Create a com.ibm.commerce.catalog-ext directory in WC > xml > config if it does not exist.
    2. Copy the wc-content-version.xml file from the com.ibm.commerce.catalog-fep directory or com.ibm.commerce.catalog-ext directory.
    3. Modify the wc-content-version.xml file to enable the inherited catalog object.
      For example, if you want to enable the content version for any of the following objects:
      Inherited object types and definition files
      Business objects Object Type
      Inherited Product InheritedProduct
      Inherited SKU InheritedProductSKU
      Inherited Catalog Group SKU InheritedCatalogGroupSKU
      Inherited Bundle InheritedBundle
      Inherited Kit InheritedKit
      • Remove the configuration for the Catalog and CatalogGroup noun. The configuration file must contain only the configuration for CatalogEntry noun.
      • Remove the configuration groups for non-inherited objects. Include only the configuration group for the inherited objects in the file.
      • Change the enabled value from false to true.
      The custom wc-content-version.xml file is shown:
      <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.ibm.commerce.catalog" id="-1">
      		<wc:ContentVersionNoun name="CatalogEntry" topTable="CATENTRY" className="com.ibm.commerce.catalog.version.CatalogEntryContentVersionServiceImpl">
      			<wc:ConfigGroup id="-4">
         				<wc:ContentVersionUIObject name="InheritedProduct" enabled="true" />
            				<wc:ContentVersionUIObject name="InheritedProductSKU" enabled="true" />
             				<wc:ContentVersionUIObject name="InheritedCatalogGroupSKU" enabled="true" />
             				<wc:ContentVersionUIObject name="InheritedBundle" enabled="true" />
             				<wc:ContentVersionUIObject name="InheritedKit" enabled="true" />
             				<wc:ContentVersionRelatedTable name="MASSOCCECE" whereClause="CATENTRY_ID_FROM=? AND STORE_ID=?" 
      					values="${objectId}, ${storeId}" enabled="true"/>
      			</wc:ConfigGroup>
       		</wc:ContentVersionNoun>
      	</wc:ContentVersionContainer>
      </wc:ContentVersionConfiguration>
    4. Save your changes.
  3. Run the updateVersionSchema utility to create tables in your version schema for the inherited objects. See UpdateVersionSchema utility for instructions on how to run the utility.
  4. Update the object definition file for the business object you want to enable content versioning for.
    The catalog object definition files are in the following directory: LOBTools > WebContent > config > commerce > catalog > objectDefinitions.
    Inherited object types and definition files
    Business objects Object Type File
    Inherited Product InheritedProduct ProductPrimaryObjectDefinition.def
    Inherited SKU InheritedProductSKU ProductSKUPrimaryObjectDefinition.def
    Inherited Catalog Group SKU InheritedCatalogGroupSKU CatalogGroupSKUPrimaryObjectDefinition.def
    Inherited Bundle InheritedBundle BundlePrimaryObjectDefinition.def
    Inherited Kit InheritedKit KitPrimaryObjectDefinition.def
    1. Open the object definition file for the business object, and locate the definition for the inherited object.
    2. Add the GetChildrenService class for content version. This class is used to retrieve content versions from the server.
      <!--- 
      		Retrieves the content version object for this object
      	-->		
      	<GetChildrenService objectTypes="ContentVersion" url="/cmc/GetContentVersions">
      		<ServiceParam name="storeId"/>
      		<ServiceParam name="objectId" propertyName="catentryId"/>
      		<ServiceParam name="objectType" value="object_type"/>
      		<ServiceParam name="basedOnVersionNumber" propertyName="basedOnVersionNumber"/>
      	</GetChildrenService>
      Note: Ensure that the object_type is the object type of the object that you want to version. In this case, it is the inherited object type as listed in the preceding table.
    3. Add the ReferenceObjectDefinition class for content version. This class defines the object definition for the content version.
      <!---  
      	    Reference object definition for the versioned catalog group
      	-->
      	<ReferenceObjectDefinition baseDefinitionName="wcfBaseContentVersion" referencedType="object_type"/>
      Note: Ensure that the object_type is the object type of the object that you want to version. In this case, it is the inherited object type as listed in the preceding table.
    4. Add the CreateContentVersionClientAction class. This class enables the create content version client action.
      <!---
      		Create Content Version Client Action
      	-->
      	<CreateContentVersionClientAction />
  5. Update the properties view definition file for the business object.
    The catalog objects properties view files are in the following directory: LOBTools > WebContent > config > commerce > catalog > propertiesViews
    Inherited object types and definition files
    Business objects Object Type File
    Inherited Product InheritedProduct ProductPropertiesView.def
    Inherited SKU InheritedProductSKU ProductSKUPropertiesView.def
    Inherited Catalog Group SKU InheritedCatalogGroupSKU CatalogGroupSKUPropertiesView.def
    Inherited Bundle InheritedBundle BundlePropertiesView.def
    Inherited Kit InheritedKit KitPropertiesView.def
    The version tab is only displayed in non-inherited Catalog objects. You expand the condition to include inherited and non-inherited objects with an OR condition. The following code snippet shows the version tab definition for a Product object type:
    <PropertyTabPane name="manageVersionTab" text="${foundationResources.manageVersionTab}">
    	<!-- Only show this tab if the object type is Product, Content Version is enabled and not new object -->
    	<EnablementAndCondition conditionId="productManageVersionTabCondition">
    		<EnablementCondition checkObjectDefinition="true" propertyName="objectType" enablementValue="Product" conditionId="productManageVersionObjectTypeCondition"/>
    		<EnablementCondition enablementValue="" propertyName="objectVersionId" conditionId="noObjectVersionIdCondition"/>
    		<EnablementCondition contextName="contentVersionEnabled" enablementValue="true" conditionId="productContentVersionContextValueCondition"/>
    		<EnablementCondition checkNewObject="true" enablementValue="false" conditionId="productContentVersionNewObjectCondition"/>
    	</EnablementAndCondition>
    	<!-- Property Pane: Manage Version. This is an instantiation of the property pane definition which contains versions. -->
    <PropertyPane baseDefinitionName="wcfManageContentVersion"/>
    </PropertyTabPane>
    The modified code snippet shows the additional code that enables version tab in inherited Products. The existing check for object definition is wrapped in an OR condition. A new condition to check for the inherited object type is added as shown:
    <PropertyTabPane name="manageVersionTab" text="${foundationResources.manageVersionTab}">
    	<!-- Only show this tab if the object type is Product or Inherited Product, Content Version is enabled and not new object -->
    	<EnablementAndCondition conditionId="productManageVersionTabCondition">
    		<EnablementOrCondition conditionId="productManageVersionObjectTypeCondition">
    			<EnablementCondition checkObjectDefinition="true" propertyName="objectType" enablementValue="Product" conditionId="productManageVersionObjectTypeCondition"/>
    			<EnablementCondition checkObjectDefinition="true" propertyName="objectType" enablementValue="InheritedProduct" conditionId="productManageVersionObjectTypeCondition1"/>
    		</EnablementOrCondition>
    		<EnablementCondition enablementValue="" propertyName="objectVersionId" conditionId="noObjectVersionIdCondition"/>
    		<EnablementCondition contextName="contentVersionEnabled" enablementValue="true" conditionId="productContentVersionContextValueCondition"/>
    		<EnablementCondition checkNewObject="true" enablementValue="false" conditionId="productContentVersionNewObjectCondition"/>
    	</EnablementAndCondition>
    	<!-- Property Pane: Manage Version. This is an instantiation of the property pane definition which contains versions. -->
    	<PropertyPane baseDefinitionName="wcfManageContentVersion"/>
    </PropertyTabPane>
    This code enables the version tab in ProductPropertiesView.def to be displayed when object type is either a Product or Inherited Product.
    Note: Ensure that the enablmentValue for the new enablement condition is the object type of the object that you want to version. In this case, it is the Inherited Product.
  6. Register the struts action for the new Get version services for the inherited objects.
    1. Navigate to LOBTools > WebContent > WEB-INF.
    2. Open the struts-extension.xml file for editing.
    3. Locate the <action-mappings> element, and add the following lines under this element for the inherited object type that you want to enable for versioning.
      	<action path="/GetVersionedInheritedProduct" include="/jsp/commerce/catalog/restricted/GetVersionedCatalogEntry.jsp" />
      	<action path="/GetVersionedInheritedProductSKU" include="/jsp/commerce/catalog/restricted/GetVersionedCatalogEntry.jsp" />
      	<action path="/GetVersionedInheritedCatalogGroupSKU" include="/jsp/commerce/catalog/restricted/GetVersionedCatalogEntry.jsp" />
      	<action path="/GetVersionedInheritedKit" include="/jsp/commerce/catalog/restricted/GetVersionedCatalogEntry.jsp" />
      	<action path="/GetVersionedInheritedBundle" include="/jsp/commerce/catalog/restricted/GetVersionedCatalogEntry.jsp" />
      
  7. Restart your server.
    The Versions tab for the inherited object displays. The list of versions, and created version for the inherited object display in the tab.

What to do next

After you complete your customization:
  1. Right-click LOBTools Project; then click Build OpenLaszlo Project to produce an updated ManagementCenter.swf file under the workspace_dir\LOBTools\WebContent directory. This setting is the default environment setting.
  2. Test your changes by viewing them in the Management Center, using this URL: https://hostname:8000/lobtools.
  3. Deploy your changes to your production environment.
  4. In your production environment, copy the file wc-content-version.xml created at step 2 to <WC_installer>\instances\<instance_name>\xml\config\com.ibm.commerce.catalog-ext. If the directory does not exist, create the directory.
  5. Run the updateVersionSchema utility to create tables in your version schema for the inherited objects. See UpdateVersionSchema utility (UpdateVersionSchema utility) for instructions on how to run the utility.