Class GlobalExclusivenessEnforcementPolicy

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

    public class GlobalExclusivenessEnforcementPolicy
    extends java.lang.Object
    implements PromotionPolicy
    This is a global level policy and enforces the exclusivity of promotions at the global level. This policy must be registered with the promotion engine to take affect. If this policy is not registered with the promotion engine, promotion exclusivity at the global level will NOT be enforced, which means that even if a promotion is marked as exclusive at the global level, it can still be combined with other promotions.

    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

      • GlobalExclusivenessEnforcementPolicy

        public GlobalExclusivenessEnforcementPolicy()
    • 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
        Enforces the exclusivity of promotions at the global level. This method gets the promotion under evaluation from the PromotionContext context parameter passed and checks if the promotion has global exclusiveness policy set. If this policy is set, it checks if the promotion obtained from the PromotionArgument object (referenced using the context) is the same as the one referenced in the PromotionExecutionRecord record parameter. If the two promotions are different, the record's state is set to eliminated and this policy is set to have been violated in the record; false is returned. If the two promotions are the same, the method obtains the other promotions in sequence from the context and marks them as not applicable to the current order; in other words, it enforces the global exclusiveness setting on the promotion under evaluation by marking all the other promotions as not applicable.
        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: