< 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

  1. Open the WebSphere Commerce Developer.

  2. Open the Java™ EE perspective.

  3. Find the commands that must be overridden.

    1. Start the WebSphere 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.

      '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'
      Interface name Class name

  4. Define the new commands.

    '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'
    Interface name Class name

  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. Browse to the temporary location where CustomizeGetEntitledPrice.zip is located, and go to 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 WebSphere 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. Use the right mouse button, click the config folder. Click New>Folder. Create a folder named com.ibm.commerce.price-ext.

    3. Use 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>
        

< Previous | Next >