Introduced in Feature Pack 2

Customizing the Business Object Mediator to include custom data

Introduced in Feature Pack 2

In this lesson, the Business Object Mediator is modified to map the new columns from the search results to the user data field of the CatalogEntryView noun. As a result, the search results in the Madisons starter store include the newly added fields.

To show the search results in the Madisons starter store, the mediator configuration file is modified accordingly. When a search query is submitted, it is forwarded to the index and then all the results are returned back as XML. In WebSphere Commerce search, the mediation layer handles how the results are manipulated and populated into the logical nouns for other services such as the user interface to consume. This is done in the mediator configuration file. The logical name mapping to the noun fields is provided so that the WebSphere Commerce runtime can automatically populate the fields. Since warranty fields are new and they do not have a placeholder in the CatalogNavigationViewType noun, they are mapped into the user data field.

About this task

Procedure

  1. Navigate to the following directory:
    • WC/xml/config/com.ibm.commerce.catalog-ext
  2. Open the wc-business-object-mediator.xml file, created in a previous warranty tutorial:
  3. Add the following mapping. You should note that the syntax of the mapping may be different from other BOD mediator mappings.
    
    <_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"
    className="com.ibm.commerce.catalog.facade.server.services.dataaccess.bom.mediator.solr.SolrReadCatalogNavigationViewMediator">
    <_config:mediator-properties>
    
    <_config:mediator-property name="CatalogEntryView/UserData[(Name='WarrantyTerm')]" value="warterm" />
    <_config:mediator-property name="CatalogEntryView/UserData[(Name='WarrantyType')]" value="wartype" />
    <_config:mediator-property name="CatalogEntryView/UserData[(Name='CareInstruction')]" value="careinstruction" />
    
    </_config:mediator-properties>
    
    </_config:mediator>
    </_config:object>
    
  4. Save your changes and close the file.
  5. Restart the WebSphere Commerce server.

Results