Introduced in Feature Pack 2

Adding an attribute dictionary attribute usage type

Attribute dictionary attributes have two predefined usage types: Predefined allowed value attributes and assigned value attributes. If the predefined attribute usage types are insufficient to meet your business requirements, you can create custom attribute usage types. To create custom usage types, you will need to create a custom business object mediator and catalog properties, and add the usage field in the Management Center. When assigning an attribute to a catalog entry, you will need to select the custom usage type from the drop down list for usage type.

Procedure

  1. Go to WC/xml/config.
  2. In the WC/xml/config folder, create a com.ibm.commerce.catalog-ext folder, if one does not exist.
  3. Inside the com.ibm.commerce.catalog-ext folder, create a wc-business-object-mediator.xml file. This xml file will define the mapping of the Usage column for the CATENTRATTR table for use as user data.
  4. Open the wc-business-object-mediator.xml file for editing. Add the following XML code to the file to map the usage column:
    <_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.ibm.commerce.catalog.facade.datatypes.CatalogEntryType" physicalType="com.ibm.commerce.catalog.facade.server.entity.datatypes.CatalogEntry">
    <_config:property-mapping logicalType="com.ibm.commerce.catalog.facade.datatypes.CatalogAttributeType" physicalType="com.ibm.commerce.catalog.facade.server.entity.datatypes.CatalogEntryAttributeRelation">
    <_config:userDataProperty logicalPropertyName="usage" physicalPropertyName="usage"/>
    </_config:property-mapping>
    </_config:object>
    </_config:BusinessObjectMediatorConfiguration>
  5. Add the properties to customize the Catalog properties file.
    1. Go to LOBTools/src.
    2. Create the package com.mycompany.commerce.catalog.client.lobtools.properties.
    3. In the package create the properties file CatalogLOB.properties.
    4. In the properties file, add the following properties:
      attributeUsageType1=Defining
      attributeUsageType2=Descriptive
      attributeUsageTypeA=A
      attributeUsageTypeB=B
      attributeUsageTypeC=C
    5. Extend the catalog management resource bundle.
      • Create the folder mycompany under LOBTools/WebContent/WEB-INF/src/lzx.
      • Create the folder catalog under LOBTools/WebContent/WEB-INF/src/lzx/mycompany.
      • Create the file extCatalogManagementResourceBundle.lzx under LOBTools/WebContent/WEB-INF/src/lzx/mycompany/catalog.
      • In the extCatalogManagementResourceBundle.lzx file, extend the resource bundle by adding the following code:
        <library>
        	<class name="extCatalogResourceBundle" extends="wcfResourceBundle" baseName="com.mycompany.commerce.catalog.client.lobtools.properties.CatalogLOB">
        		<wcfResourceBundleKey name="attributeUsageType1"/>
        		<wcfResourceBundleKey name="attributeUsageType2"/>
        		<wcfResourceBundleKey name="attributeUsageTypeA"/>
        		<wcfResourceBundleKey name="attributeUsageTypeB"/>
        		<wcfResourceBundleKey name="attributeUsageTypeC"/>
        	</class>
        	<extCatalogResourceBundle id="extCatalogResources"/>
        </library>
    6. Go to LOBTools/WebContent/WEB-INF/src/lzx/commerce/catalog/CatalogExtensionsLibrary.lzx. Add the following code.
      <library> 
      	<!-- File to add customer libraries -->
      	<include href="../../mycompany/catalog/extCatalogManagementResourceBundle.lzx"/>
      </library>
  6. Add the usage field in the Management Center object.
    1. Go to the LOBTools/WebContent/config/commerce/catalog/objectDefinitions/ directory.
    2. Open AttributeDictionaryCommonObjectDefinition.def for editing.
    3. Under the object definitions:
      • catBaseCatalogEntryReferenceDescriptiveAttributeDictionaryAttributeWithAllowedValues
      • catBaseCatalogEntryReferenceDescriptiveAttributeDictionaryAttributeWithAssignedValues
      Add the following property definition as child elements under both object definitions:
      <PropertyDefinition displayName="${catalogResources.attributeUsagePrompt}" maximumSize="254" propertyName="xrel_usage" required="true">
      		<PropertyValue displayName="${extCatalogResources.attributeUsageType2}" value="2"/>
      		<PropertyValue displayName="${extCatalogResources.attributeUsageTypeA}" value="A"/>
      		<PropertyValue displayName="${extCatalogResources.attributeUsageTypeB}" value="B"/>
      		<PropertyValue displayName="${extCatalogResources.attributeUsageTypeC}" value="C"/>
      </PropertyDefinition>
    4. Go to the LOBTools/WebContent/config/commerce/catalog/listViewDefinitions/ directory.
    5. Open CatalogEntryAttrDictDescriptiveAttributeGrid.def for editing.
    6. Insert the line:<GridComboBox editable="true" languageSensitive="false" name="xrel_usage" propertyName="xrel_usage" text="${catalogResources.attributeUsagePrompt}" visible="true" width="120"/> after the line: <GridComboBox editable="false" enableFilter="true" name="attrDataType" objectPath="AttributeDictionaryAttributes" propertyName="attrDataType" required="true" text="${catalogResources.attributeDataType_ColumnHeader}" visible="true" width="130"/>
  7. Right-click on project LOBTools. Click Build OpenLazlo Project to run the build process.
  8. Restart the server.