< Previous | Next >Customize the WebSphere Commerce getEntitledPrice service
We can customize the GetEntitledPrice service to create new command classes to override the supplied commands.
Task info
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
- Open the WebSphere Commerce Developer.
- Open the Java™ EE perspective.
- Find the commands that must be overridden.
- Start the WebSphere Commerce Test Server from the
serversview.- Open http://localhost/webapp/wcs/admin/servlet/db.jsp
- Input the SQL: SELECT interfacename, classname FROM CMDREG WHERE classname LIKE '%FetchEntitledPrice%';
- The following results show. The results shown are the 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'
- 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'
- Expand the project WebSphereCommerceServerExtensionsLogic under src. Create a package, and name it com.mycompany.commerce.price.facade.server.commands.
- Import the source code.
- Right-click the com.mycompany.commerce.price.facade.server.commands package.
- Click Import>General>File System>Next.
- Browse to the temporary location where CustomizeGetEntitledPrice.zip is located, and go to WebSphereCommerceServerExtensionsLogic\src\com\mycompany\commerce\price\facade\server\commands.
- Choose all files and click Finish. Click Yes to All to overwrite any existing files.
- Organize the imports for the WebsphereCommerceServerExtensionsLogic project:
- Open the Java perspective in the WebSphere Commerce Developer.
- Expand the WebSphereCommerceServerExtensionsLogc project, right click src.
- Click Source>Organize Imports.
- Add new configurations to support the new
value pointparameter. The configurations to support the new parameter are required when the user usesORto combine multiple conditions in one request.
- Go to WC>xml>config.
- Use the right mouse button, click the config folder. Click New>Folder. Create a folder named com.ibm.commerce.price-ext.
- Use the right mouse button, click com.ibm.commerce.price-ext. Click New>File. Create anew file named wc-component.xml.
- 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>