Feature Pack 6

Customizing business object mediators

The business object mediator maps physical search index fields to their corresponding logical fields in the CatalogEntryView noun. Custom physical index fields can be mapped by using the UserData fields. Your custom mediator must extend from an existing business object mediator in the noun; not from an abstract mediator.

Procedure

  1. Add an entry to the wc-business-object-mediator.xml file in the following directory. If it does not exist, create it:
    • WC_installdir/workspace\WC\xml\config\com.ibm.commerce.catalog-ext
  2. The following example shows how the CatalogEntry customizable fields, field3, and field5 can be mapped to the UserData logical field. It also shows how a custom post mediator is included:
    Customization Code snippet
    Default wc-business-object-mediator.xml content (start).
    <_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.CatalogNavigationViewType" 
              physicalType="com.ibm.commerce.catalog.facade.server.services.search.metadata.solr.SolrCatalogNavigationViewImpl">      
    <_config:mediator interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.ReadBusinessObjectMediator"
    
    The CatalogEntry customizable fields, field3, and field5 are mapped to the UserData logical field.
    <_config:mediator-property
    
    name="CatalogEntryView/UserData[(Name='field3')]"
    value="catentry_field3" />
    <_config:mediator-property
    name="CatalogEntryView/UserData[(Name='field5')]"
    value="catentry_field5" />
    </_config:mediator-properties>
    
    Note: If the index field contains multi-value, then the value stored in the UserData will be multi-value, with each value separated by a semi-colon (;).
    The custom post mediator is included.
    <_config:part-mediator interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.ReadBusinessObjectPartMediator">
    <_config:part-mediator-implementation className="com.mycompany.commerce.catalog.facade.server.services.dataaccess.bom.mediator.solr. SolrReadCatalogEntryViewSamplePostMediator" />        
    </_config:part-mediator>
    
    Default wc-business-object-mediator.xml file content (end).
    </_config:mediator>
    </_config:object>
    </_config:BusinessObjectMediatorConfiguration>