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
- Open the sample business object configuration file: wc-loader-catalog.xml
- Find the
<_config:BusinessObjectBuilder>
element. - Set the
className
attribute value to be the com.ibm.commerce.foundation.dataload.businessobjectbuilder.BaseBusinessObjectBuilder object builder classFor 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> - Specify the business object component package name.
Specify this attribute with the
packageName
element. Every component has one package name. The following is a list of the package name for each component:- Catalog component: com.ibm.commerce.catalog.facade.datatypes.CatalogPackage
- Inventory component: com.ibm.commerce.inventory.facade.datatypes.InventoryPackage
Price component: com.ibm.commerce.price.facade.datatypes.PricePackage
Member component: com.ibm.commerce.member.facade.datatypes.MemberPackage
Commerce Composer component: com.ibm.commerce.pagelayout.facade.datatypes.PageLayoutPackage
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> - 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
Inventory InventoryAvailabilityType
ExpectedInventoryRecordType
InventoryReceiptType.
Price PriceListType
PriceConstantType
PriceEquationType
PriceRuleType
Member PersonType
MemberGroupType
OrganizationType
Commerce Composer LayoutType
PageType
WidgetDefinitionType
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> - 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.The<_config:mapping>
attributes are defined as follows: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 thevalueFrom
attribute. valueFrom
- The
valueFrom
attribute indicates how to resolve the value. The default value is theInputData
. The following are supported valueFrom:InputData
: It indicates that the value is fromInputData
.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.
- 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
is a list of the package name for each component:
- Catalog component: com.ibm.commerce.catalog
- Inventory component: com.ibm.commerce.inventory
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>
- Specify any configurable properties for the business object
mediator that you want. These properties must be set 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:
If the<_config:BusinessObjectMediator className="com.ibm.commerce.catalog. dataload.mediator.CatalogEntryMediator" componentId="com.ibm.commerce.catalog"> <_config:property name="markForDelete" value="true" /> </_config:BusinessObjectMediator>
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:
If the<_config:BusinessObjectMediator className="com.ibm.commerce.catalog.dataload. mediator.CatalogGroupMediator" componentId="com.ibm.commerce.catalog"> <_config:property name="markForDelete" value="true" /> </_config:BusinessObjectMediator>
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.
- Set the
- Optional: If you want 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 for use with Catalog Upload. To review these files, go to the following directory:WC_eardir/xml/config/com.ibm.commerce.catalog/dataload
WC_eardir\xml\config\com.ibm.commerce.catalog\dataload
workspace_dir\WC\xml\config\com.ibm.commerce.catalog\dataload
- wc-loader-AD-attribute-allowed-values.xml
- wc-loader-catalog-entry.xml
- wc-loader-catalog-group.xml
- wc-loader-catalog-group-description.xml