com.ibm.commerce.marketing.promotion.policy

Class PromotionPolicyBase

  • java.lang.Object
    • com.ibm.commerce.marketing.promotion.policy.PromotionPolicyBase
  • All Implemented Interfaces:
    PromotionPolicy, XMLizable, java.io.Serializable
    Direct Known Subclasses:
    NoneZeroOrderTotalPolicy, OrderQualifyingTotalEnforcementPolicy


    public abstract class PromotionPolicyBase
    extends java.lang.Object
    implements PromotionPolicy
    The PromotionPolicyBase class provides the basic toXML() and fromXML() methods for simple promotion policies. These policies do not have a serialized XML form beyond the simplest form illustrated below.
      <PromotionPolicy impl="fully qualified implementation class name">
            <PromotionPolicyKey>
                    <PolicyName>Unique Name for the policy</PolicyName>
                    <StoreKey>
                            <DN>o=root organization</DN>
                            <Identifier>BlueStore 202</Identifier>
                    </StoreKey>
            </PromotionPolicyKey>
            <Status>Active</Status>
      </PromotionPolicy>
     
    See Also:
    Serialized Form
    • Constructor Detail

      • PromotionPolicyBase

        public PromotionPolicyBase()
        Constructor.
    • Method Detail

      • getDescription

        public java.lang.String getDescription(java.util.Locale locale,
                                               int type)
        Description copied from interface: PromotionPolicy
        Returns the description of the promotion policy based on its type and locale.
        Specified by:
        getDescription in interface PromotionPolicy
        Parameters:
        locale - for which the description is being retrieved.
        type - the type of description to retrieve. Possible type values include Description.ADMIN_DESC, Description.SHOPPER_LONG_DESC or Description.SHOPPER_SHORT_DESC.
        Returns:
        the description
        See Also:
        PromotionPolicy.getDescription(Locale, int)
      • apply

        public abstract boolean apply(PromotionContext context,
                                      PromotionExecutionRecord record)
                               throws PromotionPolicyApplicationException
        Description copied from interface: PromotionPolicy
        This method is used to apply the policy to a promotion to deem if any violation is found on application. If on applying the promotion policy, a violation is found, the method returns false and the promotion can not be applied to the order. If however no violation is found on applying the promotion policy to the promotion, then the promotion can be applied to the order.
        Specified by:
        apply in interface PromotionPolicy
        Parameters:
        context - PromotionContext, created and passed to this policy by the engine
        record - the PromotionExecutionRecord for which violation is tested.
        Returns:
        true if by applying this promotion (as indicated by the record parameter), no violation with this policy is found. false a violation is found, this promotion can not be applied.
        Throws:
        PromotionPolicyApplicationException - when the evaluation runs into any unexpected error
        See Also:
        PromotionPolicy.apply(PromotionContext, PromotionExecutionRecord)
      • getStatus

        public int getStatus()
        Returns the status.
        Specified by:
        getStatus in interface PromotionPolicy
        Returns:
        The status.
      • setStatus

        public void setStatus(int aStatus)
        Sets the status.
        Specified by:
        setStatus in interface PromotionPolicy
        Parameters:
        aStatus - The status to set