Extending a business object mediator

Occasionally the default business objects provided with WebSphere Commerce are insufficient to describe the types of data used in certain businesses, making it is necessary to extend or create new business objects. If you have created custom business objects, then you will need to create a custom business object mediator in order to override existing component services to understand them.

Procedure

  1. Create the custom mediator:
    1. Open WebSphere Commerce Developer.
    2. Open the Java EE perspective and select the Enterprise Explorer view.
    3. Go to WebSphereCommerceServerExtensionsLogic > src.
    4. Right-click src. Select New > Package.
    5. Name the package.
    6. Click Finish.
    7. Right-Click the package. Select New > Class.
    8. Name the class.
    9. Click Finish.
  2. Determine the mediator to extend:
    1. Go to WC\xml\config\com.ibm.commerce.catalog-ext.
    2. Open the wc-business-object-mediator.xml file.
    3. Optional: If wc-business-object-mediator.xml does not exist, select New > Other > XML > XML > Next.
      1. Select Create an XML file from scratch.
      2. Click Next.
      3. Name the file: wc-business-object-mediator.xml.
      4. Click Finish.
    4. From the wc-business-object-mediator.xml file, determine the mediator to extend.
  3. Open the created class. Add the required logic to the class.
  4. Open the created Java method.
  5. Import the package from wc-business-object mediator.xml
  6. Right-click the Java method. Select Source > Override/Implement Methods. Select the method to override.
  7. Update wc-business-object-mediator.xml to instruct the component service module to use the extended mediator.