Configuring the component business object builder

Use the BaseBusinessObjectBuilder to build a component business object that is based on the specified configuration properties, and the input data. You can configure this builder by defining sub elements and attribute values in the business object configuration file.

Procedure

  1. Open the wc-loader-object.xml business object configuration file that you need to configure.
    If you need to create a file, copy a sample business object configuration file, such as the wc-loader-catalog.xml file and rename the file. Sample business object configuration files are provided for different component objects within the component-specific directories in the following directory:
    • WC_installdir/samples/DataLoad
    • WCDE_installdir/samples/DataLoad
  2. Find the <_config:BusinessObjectBuilder> element.
  3. Set the className attribute value to be the com.ibm.commerce.foundation.dataload.businessobjectbuilder.BaseBusinessObjectBuilder object builder class.
    For example, the following snippet specifies the base business object builder class
    
    <_config:BusinessObjectBuilder 
      className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.BaseBusinessObjectBuilder"
      packageName="com.ibm.commerce.catalog.facade.datatypes.CatalogPackage" dataObjectType="AttributeDictionaryAttributeType" >
    </_config:BusinessObjectBuilder>
  4. Specify the business object component package name.
    Specify this attribute with the packageName element that correspond to the component that you are updating.
    Component packageName
    Catalog com.ibm.commerce.catalog.facade.datatypes.CatalogPackage
    Commerce Composer com.ibm.commerce.pagelayout.facade.datatypes.PageLayoutPackage
    Inventory com.ibm.commerce.inventory.facade.datatypes.InventoryPackage
    Marketing com.ibm.commerce.marketing.facade.datatypes.MarketingPackage
    Marketing (Content) com.ibm.commerce.content.facade.datatypes.ContentPackage
    Member com.ibm.commerce.member.facade.datatypes.MemberPackage
    Price com.ibm.commerce.price.facade.datatypes.PricePackage
    The following snippet specifies the catalog package for the business object builder class
    <_config:BusinessObjectBuilder className="com.ibm.commerce.foundation.dataload.
    businessobjectbuilder.BaseBusinessObjectBuilder" 
      packageName="com.ibm.commerce.catalog.facade.datatypes.CatalogPackage"> 
    dataObjectType="AttributeDictionaryAttributeType" >
    </_config:BusinessObjectBuilder>
  5. Specify the data object type for the business object.
    Specify this attribute with the dataObjectType element. The data object type is different for each business object component type:
    Component Supported data object types
    Catalog
    • CatalogType
    • CatalogGroupType
    • CatalogEntryType
    • AttributeDictionaryAttributeType
    Commerce Composer
    • LayoutType
    • PageType
    • WidgetDefinitionType
    Inventory
    • InventoryAvailabilityType
    • ExpectedInventoryRecordType
    • InventoryReceiptType.
    Marketing
    • ActivityType
    • AttachmentType
    • CampaignType
    • MarketingContentType
    • MarketingSpotType
    Member
    • PersonType
    • MemberGroupType
    • OrganizationType
    Price
    • PriceListType
    • PriceConstantType
    • PriceEquationType
    • PriceRuleType
    The following snippet specifies the attribute dictionary attribute data object type:
    
    <_config:BusinessObjectBuilder 
      className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.BaseBusinessObjectBuilder" 
      packageName="com.ibm.commerce.catalog.facade.datatypes.CatalogPackage" 
      dataObjectType="AttributeDictionaryAttributeType" >
    </_config:BusinessObjectBuilder>
  6. Specify the data mappings for the business object. Specify the mappings within the <_config:DataMapping> element.
    Within this element, one or more <_config:mapping> elements can be specified.
    You can define the data mappings by using the following attributes.
    xpath
    The xpath to the property in the business object.
    value
    The value is populated to the business object. Typically, it is a key, and the real value depends on the valueFrom attribute.
    Note: If the value that you define is not used in the data load input file, then the Data Load utility does not throw any error or log a message.
    valueFrom
    The valueFrom attribute indicates how to resolve the value. The default value is the InputData. The following are supported valueFrom:
    • InputData: It indicates that the value is from InputData.
    • Fixed: The value is a fixed value.
    deleteValue
    The delete flag indicates whether the business object is to be deleted.
    BusinessObjectMediator
    The class name for the business object mediator that the Data Load utility is to use to write the data to the appropriate database column. For more information about specifying a business object mediator, see Configuring the business object configuration file.
  7. Specify the business object mediator for the loading the business object.
    Specify the mediator class and attributes within the <_config:BusinessObjectMediator> element. The attributes that can be specified for a mediator are defined as follows:
    className
    The business object mediator class that the Data Load utility is to use to populate a business object with the data in the input file. For more information about the available provided mediators, see Data Load utility business object mediators.
    componentId
    The identifier of the component for the business object. The following list identifies the component ID for each component:
    • Catalog component: com.ibm.commerce.catalog
    • Inventory component: com.ibm.commerce.inventory
    • Marketing: com.ibm.commerce.marketing
    • Marketing (Content): com.ibm.commerce.content
    • Price component: com.ibm.commerce.price
    • Member component: com.ibm.commerce.member
    • Commerce Composer component: com.ibm.commerce.pagelayout
    The following snippet configures a component business object builder for loading price list data
    
    <_config:BusinessObjectMediator className="com.ibm.commerce.price.dataload.mediator.OfferMediator"
     componentId="com.ibm.commerce.price">
    </_config:BusinessObjectMediator>
    
  8. Specify any configurable properties for the business object mediator within a <_config:property> element.
    Each instance of this element defines an optional property that is specific to the specified business object mediator. Each mediator can have one or more properties or might not have any properties. To set a configurable property, you must set the following attributes for the property:
    • Set the name attribute - The name of the property.
    • Set the value attribute - The value of the property.
    For example, the following snippet configures the business object mediator element for loading attribute dictionary attribute data. The mediator that is specified in this example is com.ibm.commerce.catalog.dataload.mediator.AttributeDictionaryAttributeMediator. This snippet also specifies two properties to configure this mediator:
    
    <_config:BusinessObjectBuilder 
      className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.BaseBusinessObjectBuilder" 
      packageName="com.ibm.commerce.catalog.facade.datatypes.CatalogPackage" 
      dataObjectType="AttributeDictionaryAttributeType" >
      ...
      <_config:BusinessObjectMediator 
      className="com.ibm.commerce.catalog.dataload.mediator.AttributeDictionaryAttributeMediator" 
      componentId="com.ibm.commerce.catalog" >
        <_config:property name="allowChangeAttributeType" value="true" />
        <_config:property name="validateAttribute" value="true" />
      </_config:BusinessObjectMediator>
    
    </_config:BusinessObjectBuilder>
    Note: If you are deleting catalog objects during a load operation, you can configure the business object mediator to mark for delete catalog objects instead of physically deleting the objects. By marking an object for delete, you can ensure that object still exists for any transaction, promotion, or activity that includes or uses the object. You can run the database cleanup utility later to remove any objects that are marked for delete when the object is no longer needed. To mark for delete an object, you must use a mediator that supports updating the MARKFORDELETE column in the database for the object.
    • By default, the CatalogEntryMediator mediator supports the mark for delete operation for catalog entries. To set the mark for delete flag, type the following information in the <_config:BusinessObjectMediator> element of the business object configuration file:
      
      <_config:BusinessObjectMediator 
        className="com.ibm.commerce.catalog.dataload.mediator.CatalogEntryMediator" 
        componentId="com.ibm.commerce.catalog">
           <_config:property name="markForDelete" value="true" />
      </_config:BusinessObjectMediator>
      If the markForDelete property is not provided or not set to "false" for catalog entries, the CatalogEntryMediator sets objects to be marked for delete.
    • The CatalogGroupMediator mediator supports the mark for delete operation. To set the mark for delete flag, type the following information in the <_config:BusinessObjectMediator> element of the business object configuration file:
      
      <_config:BusinessObjectMediator 
        className="com.ibm.commerce.catalog.dataload.mediator.CatalogGroupMediator" 
        componentId="com.ibm.commerce.catalog">
           <_config:property name="markForDelete" value="true" />
      </_config:BusinessObjectMediator>
      If the markForDelete property is not provided or not set to "true" for categories, the CatalogGroupMediator physically deletes objects from the database.
    • If you configure the Data Load utility to load SEO information, any relevant SEO information for the object is removed when you set the object to be marked for delete.
    • If your store uses WebSphere Commerce search, the search index rebuilds to remove the catalog objects that are marked for delete and to remove the relationships for these objects.
  9. Optional: To include the objects that you are loading within the WebSphere Commerce search index, specify the search index mediator for the business object that you are loading.
    You must also specify the data mapping for the object that is to be included within the search index.

    To specify the search index mediator and data mapping, create a second business object builder configuration for indexing the business object. Add the second business object builder configuration after the </_config:BusinessObjectBuilder> element that closes the initial business object builder configuration. For a list of the available search index mediators, see Data Load utility business object mediators.

    For example, the following snippet specifies the search index mediator for loading categories and the data that is to be included in the search index:
    
    <_config:BusinessObjectBuilder 
      className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.BaseBusinessObjectBuilder"
      packageName="com.ibm.commerce.catalog.facade.datatypes.CatalogPackage" 
      dataObjectType= "CatalogGroupType" >
      <_config:DataMapping>
      ...
      </_config:DataMapping>
      <_config:BusinessObjectMediator 
        className="com.ibm.commerce.catalog.dataload.mediator.CatalogGroupMediator" 
        componentId="com.ibm.commerce.catalog" />
    </_config:BusinessObjectBuilder>
    
    <!--  Catalog Group Search Index -->
    <_config:BusinessObjectBuilder 
      className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.BaseBusinessObjectBuilder"
      packageName="com.ibm.commerce.catalog.facade.datatypes.CatalogPackage" 
      dataObjectType="CatalogGroupType" >
      <_config:DataMapping>
        <!-- The unique reference number of the category -->
        <_config:mapping xpath="CatalogGroupIdentifier/UniqueID" value="GroupUniqueId" />
        <!-- The identifier of the category -->
        <_config:mapping xpath="CatalogGroupIdentifier/ExternalIdentifier/GroupIdentifier" 
          value="GroupIdentifier" />
        <!-- The unique reference number of the store that owns the category -->
        <_config:mapping 
          xpath="CatalogGroupIdentifier/ExternalIdentifier/StoreIdentifier/ExternalIdentifier/NameIdentifier" 
          value="StoreIdentifier" />
        <!-- The unique reference number of the parent category -->
        <_config:mapping xpath="ParentCatalogGroupIdentifier/UniqueID" value="ParentGroupUniqueId" />
        <!-- The identifier of the parent category -->
        <_config:mapping xpath="ParentCatalogGroupIdentifier/ExternalIdentifier/GroupIdentifier" 
          value="ParentGroupIdentifier" />
        <!-- The unique reference number of the store that owns the parent category -->
        <_config:mapping 
          xpath="ParentCatalogGroupIdentifier/ExternalIdentifier/StoreIdentifier/UniqueID" 
          value="ParentStoreUniqueId" />
        <!-- The identifier of the store that owns the parent category -->
        <_config:mapping 
          xpath="ParentCatalogGroupIdentifier/ExternalIdentifier/StoreIdentifier/ExternalIdentifier/NameIdentifier" 
          value="ParentStoreIdentifier" />
        <!-- The identifier of the catalog -->
        <_config:mapping xpath="Attributes/CatalogIdentifier" value="CatalogIdentifier" />
        </_config:DataMapping>
      <_config:BusinessObjectMediator 
        className="com.ibm.commerce.catalog.dataload.mediator.CatalogGroupRelationshipSearchIndexMediator" 
        componentId="com.ibm.commerce.catalog" >
      </_config:BusinessObjectMediator>
    </_config:BusinessObjectBuilder>
    
    As a reference to help you configure the data mapping for an object, review the business object configuration files that are provided by default. The provided files are for use with the Catalog Upload tool. To review these files, go to the following directory:
    • For IBM i OS operating systemAIXLinuxWC_eardir/xml/config/com.ibm.commerce.catalog/dataload
    • WindowsWC_eardir\xml\config\com.ibm.commerce.catalog\dataload
    • WebSphere Commerce Developerworkspace_dir\WC\xml\config\com.ibm.commerce.catalog\dataload
    The following files include the configuration to run search indexing:
    • wc-loader-AD-attribute-allowed-values.xml
    • wc-loader-catalog-entry.xml
    • wc-loader-catalog-group.xml
    • wc-loader-catalog-group-description.xml