Class PromotionPolicyBase

  • java.lang.Object
  • All Implemented Interfaces:
    PromotionPolicy, XMLizable,
    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">
                    <PolicyName>Unique Name for the policy</PolicyName>
                            <DN>o=root organization</DN>
                            <Identifier>BlueStore 202</Identifier>
    See Also:
    Serialized Form
    • Constructor Detail

      • PromotionPolicyBase

        public PromotionPolicyBase()
    • 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
        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.
        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
        context - PromotionContext, created and passed to this policy by the engine
        record - the PromotionExecutionRecord for which violation is tested.
        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.
        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
        The status.
      • setStatus

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