com.ibm.commerce.price.rule.runtime.engine

Class PriceRuleEngine

  • java.lang.Object
    • com.ibm.commerce.price.rule.runtime.engine.PriceRuleEngine
  • All Implemented Interfaces:
    PriceRuleConstants


    public class PriceRuleEngine
    extends java.lang.Object
    implements PriceRuleConstants
    This is the default implementation for internal price rule engine which is used to evaluate price and return calculated prices.
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
      • CLASSNAME

        public static final java.lang.String CLASSNAME
        The name of this class.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PriceRuleEngine

        public PriceRuleEngine()
    • Method Detail

      • initializeConfiguration

        public void initializeConfiguration()
                                     throws java.lang.Exception
        This method initializes the shared PriceRuleEngine object.
        Throws:
        java.lang.Exception
      • singleton

        public static PriceRuleEngine singleton()
        This method returns the shared instance of the PriceRuleEngine object.
        Returns:
        The price rule engine. It can't be null.
      • evaluatePriceRuleForContract

        public com.ibm.commerce.price.rule.runtime.objects.PriceRuleOutputObject evaluatePriceRuleForContract(java.lang.String contractId,
                                                                                                              java.lang.String catentryId,
                                                                                                              java.lang.Double quantity,
                                                                                                              java.lang.String uom,
                                                                                                              java.lang.String currency,
                                                                                                              java.util.Map extDataMap,
                                                                                                              com.ibm.commerce.price.rule.runtime.objects.PriceRuleOutputObject prOutputObject)
        This method returns an PriceRuleOutputObject object based on the contract. It will first retrieve proper price rule for a contract. Then it will invoke evaluate the price rule.
        Parameters:
        contractId - The contract id to be set. It can't be null or empty.
        catentryId - The catalog entry Id to be set. It can't be null or empty.
        quantity - The quantity to be set. It can't be null.
        uom - The UOM to be set. It can't be null or empty.
        currency - The currency to be set. It can't be null or empty.
        extDataMap - The extDataMap to be set. It can be null.
        prOutputObject - The prOutputObject to be set. It can be null.
        Returns:
        The output object including the final calculated prices. It doesn't return null.
      • evaluatePriceRule

        public com.ibm.commerce.price.rule.runtime.objects.PriceRuleOutputObject evaluatePriceRule(java.lang.String priceRuleId,
                                                                                                   java.lang.String catentryId,
                                                                                                   java.lang.Double quantity,
                                                                                                   java.lang.String uom,
                                                                                                   java.lang.String currency,
                                                                                                   java.util.Map extDataMap,
                                                                                                   com.ibm.commerce.price.rule.runtime.objects.PriceRuleOutputObject prOutputObject)
        This method returns an PriceRuleOutputObject object based on the priceRule. It will first populate the return object. Then it will invoke the preProcess, processPriceRule, postProcess method in a row.
        Parameters:
        priceRuleId - The price rule id to be set. It can't be null or empty.
        catentryId - The catalog entry Id to be set. It can't be null or empty.
        quantity - The quantity to be set. It can't be null.
        uom - The UOM to be set. It can't be null or empty.
        currency - The currency to be set. It can't be null or empty.
        extDataMap - The extDataMap to be set. It can be null.
        prOutputObject - The prOutputObject to be set. It can be null.
        Returns:
        The output object including the final calculated prices. It doesn't return null.
      • evaluatePriceRule

        public com.ibm.commerce.price.rule.runtime.objects.PriceRuleOutputObject evaluatePriceRule(com.ibm.commerce.price.rule.runtime.objects.PriceRuleObject priceRule,
                                                                                                   java.lang.String catentryId,
                                                                                                   java.lang.Double quantity,
                                                                                                   java.lang.String uom,
                                                                                                   java.lang.String currency,
                                                                                                   java.util.Map extDataMap,
                                                                                                   com.ibm.commerce.price.rule.runtime.objects.PriceRuleOutputObject prOutputObject)
        This method returns an PriceRuleOutputObject object based on the priceRule. It will first validate the price rule, then populate the return object. After that, it will invoke the preProcess, processPriceRule, postProcess method in a row.
        Parameters:
        priceRule - The price rule object to be set. It can't be null.
        catentryId - The catalog entry Id to be set. It can't be null or empty.
        quantity - The quantity to be set. It can't be null.
        uom - The UOM to be set. It can't be null or empty.
        currency - The currency to be set. It can't be null or empty.
        extDataMap - The extDataMap to be set. It can be null.
        prOutputObject - The prOutputObject to be set. It can be null.
        Returns:
        The output object including the final calculated prices. It doesn't return null.
      • validatePriceRule

        public void validatePriceRule(com.ibm.commerce.price.rule.runtime.objects.PriceRuleObject priceRule,
                                      java.lang.String catentryId,
                                      java.lang.Double quantity,
                                      java.lang.String uom,
                                      java.lang.String currency,
                                      java.util.Map extDataMap)
        This method validates a given price rule.
        Parameters:
        priceRule - The price rule object to be set. It can't be null.
        catentryId - The catalog entry Id to be set. It can't be null or empty.
        quantity - The quantity to be set. It can't be null.
        uom - The UOM to be set. It can't be null or empty.
        currency - The currency to be set. It can't be null or empty.
        extDataMap - The extDataMap to be set. It can be null.