Customizing the HCL Commerce getEntitledPrice service

You can customize the GetEntitledPrice service to create new command classes to override the supplied commands.

Before you begin

Download the file CustomizeGetEntitledPrice.zip to a temporary location in your development environment and unzip it. This file, a part of the Sterling Order Management system, is located on the IBM Sterling Order Management Software website.

About this task

In this step, you create command classes to override the supplied command, FetchEntitledPrice. FetchEntitledPrice is used by the GetEntitledPrice service to communicate with the pricing engine.

To customize the GetEntitledPrice service:

Procedure

  1. Open the HCL Commerce Developer.
  2. Open the Java EE perspective.
  3. Find the commands that must be overridden.
    1. Start the HCL Commerce Test Server from the servers view.
    2. Open http://localhost/webapp/wcs/admin/servlet/db.jsp
    3. Input the SQL: SELECT interfacename, classname FROM CMDREG WHERE classname LIKE '%FetchEntitledPrice%';
    4. The following results show. The results shown are the commands to override.

      Commands to override

      Interface name Class name
      'com.ibm.commerce.price.facade.server.commands.FetchEntitledPriceCmd+/EntitledPrice[(CatalogEntryIdentifier[UniqueID=] and ContractIdentifier[UniqueID=] and UnitPrice[Price[@currency=] and (Quantity= and Quantity[@uom=])])]' 'com.ibm.commerce.price.facade.server.commands.FetchEntitledPriceByContractAndCatentryIdCmdImpl'
      'com.ibm.commerce.price.facade.server.commands.FetchEntitledPriceCmd+/EntitledPrice[(CatalogEntryIdentifier[ExternalIdentifier[PartNumber=]] and ContractIdentifier[UniqueID=] and UnitPrice[Price[@currency=] and (Quantity= and Quantity[@uom=])])]' 'com.ibm.commerce.price.facade.server.commands.FetchEntitledPriceByContractAndPartNumberCmdImpl'
      'com.ibm.commerce.price.facade.server.commands.FetchEntitledPriceCmd+/EntitledPrice[(CatalogEntryIdentifier[UniqueID=] and UnitPrice[Price[@currency=] and (Quantity= and Quantity[@uom=])])]' 'com.ibm.commerce.price.facade.server.commands.FetchEntitledPriceByCatentryIdCmdImpl'
      'com.ibm.commerce.price.facade.server.commands.FetchEntitledPriceCmd+/EntitledPrice[(CatalogEntryIdentifier[ExternalIdentifier[PartNumber=]] and UnitPrice[Price[@currency=] and (Quantity= and Quantity[@uom=])])]' 'com.ibm.commerce.price.facade.server.commands.FetchEntitledPriceByPartNumberCmdImpl'
  4. Define the new commands.

    Interface name Class name
    'com.ibm.commerce.price.facade.server.commands.FetchEntitledPriceCmd+/EntitledPrice[(CatalogEntryIdentifier[UniqueID=] and ContractIdentifier[UniqueID=] and UnitPrice[Price[@currency=] and (Quantity= and Quantity[@uom=])] and VP=)]' 'com.mycompany.commerce.price.facade.server.commands. ExtFetchEntitledPriceByContractAndCatentryIdCmdImpl'
    'com.ibm.commerce.price.facade.server.commands.FetchEntitledPriceCmd+/EntitledPrice[(CatalogEntryIdentifier[ExternalIdentifier[PartNumber=]] and ContractIdentifier[UniqueID=] and UnitPrice[Price[@currency=] and (Quantity= and Quantity[@uom=])] and VP=)]' 'com.mycompany.commerce.price.facade.server.commands. ExtFetchEntitledPriceByContractAndPartNumberCmdImpl'
    'com.ibm.commerce.price.facade.server.commands.FetchEntitledPriceCmd+/EntitledPrice[(CatalogEntryIdentifier[UniqueID=] and UnitPrice[Price[@currency=] and (Quantity= and Quantity[@uom=])] and VP=)]' 'com.mycompany.commerce.price.facade.server.commands. ExtFetchEntitledPriceByCatentryIdCmdImpl'
    'com.ibm.commerce.price.facade.server.commands.FetchEntitledPriceCmd+/EntitledPrice[(CatalogEntryIdentifier[ExternalIdentifier[PartNumber=]] and UnitPrice[Price[@currency=] and (Quantity= and Quantity[@uom=])] and VP=)]' 'com.mycompany.commerce.price.facade.server.commands. ExtFetchEntitledPriceByPartNumberCmdImpl'
  5. Expand the project WebSphereCommerceServerExtensionsLogic under src. Create a package, and name it com.mycompany.commerce.price.facade.server.commands.
  6. Import the source code.
    1. Right-click the com.mycompany.commerce.price.facade.server.commands package.
    2. Click Import>General>File System>Next.
    3. Go to the temporary location where you unzipped CustomizeGetEntitledPrice.zip, and navigate to the subdirectory WebSphereCommerceServerExtensionsLogic\src\com\mycompany\commerce\price\facade\server\commands.
    4. Choose all files and click Finish. Click Yes to All to overwrite any existing files.
  7. Organize the imports for the WebsphereCommerceServerExtensionsLogic project:
    1. Open the Java perspective in the HCL Commerce Developer.
    2. Expand the WebSphereCommerceServerExtensionsLogc project, right click src.
    3. Click Source>Organize Imports.
  8. Add new configurations to support the new value point parameter. The configurations to support the new parameter are required when the user uses OR to combine multiple conditions in one request.
    1. Go to WC>xml>config.
    2. Using the right mouse button, click the config folder. Click New>Folder. Create a folder named com.ibm.commerce.price-ext.
    3. Using the right mouse button, click com.ibm.commerce.price-ext. Click New>File. Create anew file named wc-component.xml.
    4. Copy and paste the following content into wc-component.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      
      <_config:DevelopmentComponentConfiguration
      				xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      				xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/founda
      tion/config ../xsd/wc-component.xsd "
      			xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/
      config">
      
      				<_config:valuemappingservice>
      							<_config:valuemapping externalName="XPathKey"
      										internalName="XPathKey">
      
      										<_config:valuemap
      
      				externalValue="/EntitledPrice\[\(CatalogEntryIdentifier\[External
      Identifier\[PartNumber=\]\] and \(Quantity= and Quantity\[@uom=\]\]\]
      and VP+\) ( or
      \(CatalogEntryIdentifier\[ExternalIdentifier\{PartNumber+\]\] and
      ContractIdentifier\[UniqueID=\] and UnitPrice\[Price\[@currency+\] and
      \(Quantity= and Quantity\[@uom=\]\)\] and VP+\))*\]"
      
      				internalValue="/EntitledPrice[ (CatalogEntryIdentifier[ExternalIde
      ntifier{PartNumber=]] and ContractIdentifier[UniqueID=] and
      UnitPrice[Price[@currency=} and (Quantity= and Quantity{@uom=])] and
      VP+)]" />
      
      									<_config:valuemap
      
      				externalValue="/EntitledPrice\[\(CatalogEntryIdentifier\[External
      Identifier\[PartNumber=\]\] and ContractIdentifier\[UniqueID=\] and
      PricingDate= and UnitPrice\[Price\[@currency=\] and \(Quantity= and
      Quantity\[@uom=\]\)\] and VP=\) ( or
      \(CatalogEntryIdentifier\[ExternalIdentifier\[PartNumber=\]\] and
      ContractIdentifier\[UniqueID+\] and PricingDate= and
      UnitPrice\(Price\[@currency=\] and \(Quantity= and Quantity\[@uom=\]\)\]
      and VP=\))*\]"
      
      				internalValue="/EntitledPrice[(CatalogEntryIdentifier[ExternalIde
      ntifier[PartNumber=]] and ContractIdentifier(UniqueID=] and
      UnitPrice[Price[@currency=} and (Quantity= and Quantity[@uom=])] and
      VP=)]" />
      
      								<_config:valuemap
      
      				externalValue="/EntitledPrice\[\(CatalogEntryIdentifier\[UniqueID
      =\] and ContractIdentifier\[UniqueID=\] and
      UnitPrice\[Price\[@currency=\] and \(Quantity= and Quantity\[@uom=\]\)\]
      and VP-\)(or \(CatalogEntryIdentifier\[UniqueID=\] and
      (Quantity= and Quantity[@uom=])] and VP=\))*\]"
      
      				internalValue="/EntitledPrice[(CatalogEntryIdentifier[UniqueID=] 
      and ContractIdentifier[UniqueID=] and UnitPrice[Price[@currency=} and
      (Quantity= and Quantity[@uom=])] and VP=)]" />
      
      								<_config:valuemap
      
      				externalValue="/EntitledPrice\[\(CatalogEntryIdentifier\[UniqueID
      =\] and ContractIdentifier\[UniqueID=\] and PricingDate= and
      UnitPrice\[Price\{@currency=\] and \(Quantity= and Quantity\[@uom=\]\)\]
      and VP=\)( or \(CatalogEntryIdentifier\{UniqueID=\} and
      ContractIdentifier\[UniqueID=\] and PricingDate= and
      UnitPrice\[Price\[@currency=\] and \(Quantity= and Quantity\[@uom=\]\)\]
      and VP=\))*\]"
      
      				internalValue="/EntitledPrice[(CatalogEntryIdentifier[UniqueID=]
      and ContractIdentifier[UniqueID=] and UnitPrice[Price[@currency=] and
      (Quantity= and Quantity[@uom=])] and VP=)]" />
      
      							<_config:valuemap
      
      				externalValue="/EntitledPrice\[\(CatalogEntryIdentifier\[UniqueID
      =\} and UnitPrice\[Price\[@currency=\] and \(Quantity= and
      Quantity\[@uom=\]\)\] and VP=\) ( or
      \(CatalogEntryIdentifier\[UniqueID=\] and UnitPrice\[Price\[@currency=\]
      and \(Quantity= and Quantity\[@uom=\]\)]\] and VP=\))*\]"
      
      				internalValue="/EntitledPrice[(CatalogEntryIdentifier[UniqueID=]
      and UnitPrice[Price[@currency=] and (Quantity= and Quantity[@uom=])]
      and VP=)]" />
      
      							<_config:valuemap
      
      				externalValue="/EntitledPrice\[\(CatalogEntryIdentifier\[UniqueID
      =\] and PricingDate= and UnitPrice\[Price\[@currency=\] and \(Quantity=
      and Quantity/[@uom=\]\)\] and VP=\)( or
      \(CatalogEntryIdentifier\[UniqueID=\] and PricingDate= and
      UnitPrice\[Price\[@currency=\] and \(Quantity= and Quantity\[@uom=\]\)\]
      and VP=\))*)]"
      
      				internalValue="/EntitledPrice[(CatalogEntryIdentifier[UniqueID=]
      and UnitPrice[Price[@currency=] and (Quantity= and Quantity[@uom=])]
      and VP=)]" />
      
      							<_config:valuemap
      
      				externalValue="/EntitledPrice\[\(CatalogEntryIdentifier\[UniqueID
      =\] and UnitPrice\[Price\[@currency=\]\] and VP=\)( or
      \(CatalogEntryIdentifier\[UniqueID=\] and
      UnitPrice\[Price\[@currency=\]\] and VP=/))*\]"
      
      				internalValue="/EntitledPrice[(CatalogEntryIdentifier[UniqueID=]
      and UnitPrice[Price[@currency=]] and VP=)]" />
      
      							<_config:valuemap
      
      				externalValue="/EntitledPrice\[\(CatalogEntryIdentifier\[UniqueID
      =\] and PricingDate= and UnitPrice\[Price\[@currency=\]\] and VP=\)( or
      \(CatalogEntryIdentifier\[UniqueID=\] and PricingDate= and
      UnitPrice\[Price\[@currency=\]\] and VP=\))*\]"
      
      				internalValue="/EntitledPrice[(CatalogEntryIdentifier[UniqueID=]
      and UnitPrice[Price[@currency=]] and VP=)]" />
      
      							<_config:valuemap
      
      				externalValue="/EntitledPrice\]\(CatalogEntryIdentifier\[External
      Identifier\[PartNumber=\]\] and UnitPrice\[Price\[@currency=\] and
      \(quantity= and Quantity\[@uom=\]\)\] and VP=\)( or
      \(CatalogEntryIdentifier\[ExternalIdentifier\[PartNumber=\]\] and
      UnitPrice\[Price\[@currency=\] and \(Quantity= and Quantity\[@uom=\])\]
      and VP=\))*\]"
      
      				internalValue="/EntitledPrice[(CatalogEntryIdentifier[ExternalIde
      ntifier[PartNumber=]] and UnitPrice[Price[@currency=] and (Quantity=
      and Quantity[@uom=])] and VP=)]" />
      
      							<_config:valuemap
      
      				externalValue="/EntitledPrice\[\(CatalogEntryIdentifier\[External
      Identifier\[PartNumber=\]\] and \(Quantity= and Quantity\[@uom=\]\)\]
      and VP=\)( or
      \(CatalogEntryIdentifier\[ExternalIdentifier\[PartNumber=\]\] and
      PricingDate= and UnitPrice\[Price\[@currency=\] and \(Quantity= and
      Quantity\[@uom=\]\)\] and VP=\))*\]"
      
      				internalValue-"/EntitledPrice[(CatalogEntryIdentifier[ExternalIde
      ntifier[PartNumber=]] and UnitPrice[Price[@currency=] and (Quantity=
      and Quantity[@uom=])] and VP=)]" />	
      
      							<_config:valuemap
      
      				externalValue="/EntitledPrice\[\(CatalogEntryIdentifier\[External
      Identifier\[PartNumber=\]\] and UnitPrice\(Price\[@currency=\]\] and
      VP=\)( or\(CatalogEntryIdentifier\[ExternalIdentifier\[PartNumber=\]\]
      and UnitPrice\[Price\[@currency=\]\] and VP=\)*\]" 
      
      				internalValue="/EntitledPrice[(CatalogEntryIdentifier[ExternalIde
      ntifier[PartNumber=]] and UnitPrice[Price[@currency=]] and VP=)]" />
      
      							<_config:valuemap
      
      				externalValue="/EntitledPrice\]\(CatalogEntryIdentifier\[External
      Identifier\[PartNumber=\]\] and PricingDate= and
      UnitPrice\[Price\\[@currency=\]\] and VP=\)(or
      \(CatalogEntryIdentifier\[ExternalIdentifier\[PartNumber=\]\] and
      PricingDate= and UnitPrice\[Price\[@currency=\]\] and VP=\))*\]"
      
      				internalValue="/EntitledPrice[(CatalogEntryIdentifier[ExternalIde
      ntifier[PartNumber=]] and UnitPrice[Price[@currency=]] and VP=)]" />
      
      						</_config:valuemapping>
      				</_config:valuemappingservice>
      </_config:DevelopmentComponentConfiguration>