Class OnlyOnePromotionGovernedByThisPoliceAppliesPolicy

  • java.lang.Object
  • All Implemented Interfaces:
    PromotionPolicy, XMLizable,

    public class OnlyOnePromotionGovernedByThisPoliceAppliesPolicy
    extends java.lang.Object
    implements PromotionPolicy
    This promotion policy allows one and only one promotion governed by this policy to be applied to an order. This can be either a global or a group level policy. If this policy is registered with a group, only one promotion in the group can be applied to an order. If this policy is registered as a global policy, only one promotion can be applied regardless of group membership.

    XML Snippet:

        <PromotionPolicy impl="">
                    <PolicyName>Unique Name for the policy</PolicyName>
                            <DN>o=root organization</DN>
                            <Identifier>BlueStore 202</Identifier>
            <!-- Active, Inactive or Deleted -->
    See Also:
    Serialized Form
    • Constructor Detail

      • OnlyOnePromotionGovernedByThisPoliceAppliesPolicy

        public OnlyOnePromotionGovernedByThisPoliceAppliesPolicy()
    • 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 boolean apply(PromotionContext context,
                             PromotionExecutionRecord record)
                      throws PromotionPolicyApplicationException
        This method enforces the promotion policy. This method obtains the promotions currently governed by this promotion policy, using the PromotionContext context object. For each of these promotions, if the promotion is NOT found to be the same as the promotion obtained from the PromotionExecutionRecord record parameter, then it is marked as not applicable in the context; in other words, it obtains all the promotions other than the one referenced in the record and marks then as not applicable and therefore enforces the policy. After doing the above, the method returns a value of true.
        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()
        Description copied from interface: PromotionPolicy
        Returns the status of this promotion policy
        Specified by:
        getStatus in interface PromotionPolicy
        status of this promotion: one of the constants of POLICY_STATUS_ACTIVE, POLICY_STATUS_INACTIVE, POLICY_STATUS_DELETED.
        See Also:
      • setStatus

        public void setStatus(int newStatus)
        Description copied from interface: PromotionPolicy
        Sets the status of a promotion policy. Possible values include one of the constants of POLICY_STATUS_ACTIVE, POLICY_STATUS_INACTIVE, POLICY_STATUS_DELETED.
        Specified by:
        setStatus in interface PromotionPolicy
        newStatus - the new status to set
        See Also: