com.ibm.commerce.marketing.promotion.policy

Interface PromotionPolicy

    • Field Detail

      • POLICY_STATUS_ACTIVE

        static final int POLICY_STATUS_ACTIVE
        Value of the status of a promotion policy to indicate that it is active.
        See Also:
        Constant Field Values
      • POLICY_STATUS_INACTIVE

        static final int POLICY_STATUS_INACTIVE
        Value of the status of a promotion policy to indicate that it is inactive.
        See Also:
        Constant Field Values
      • POLICY_STATUS_DELETED

        static final int POLICY_STATUS_DELETED
        Value of the status of a promotion policy to indicate that it is marked for deletion.
        See Also:
        Constant Field Values
    • Method Detail

      • getKey

        PromotionPolicyKey getKey()
        Returns the key of this promotion policy
        Returns:
        key of the promotion policy
      • getDescription

        java.lang.String getDescription(java.util.Locale locale,
                                        int type)
        Returns the description of the promotion policy based on its type and locale.
        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
      • apply

        boolean apply(PromotionContext context,
                      PromotionExecutionRecord record)
               throws PromotionPolicyApplicationException
        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.
        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
      • getStatus

        int getStatus()
        Returns the status of this promotion policy
        Returns:
        status of this promotion: one of the constants of POLICY_STATUS_ACTIVE, POLICY_STATUS_INACTIVE, POLICY_STATUS_DELETED.
      • setStatus

        void setStatus(int newStatus)
        Sets the status of a promotion policy. Possible values include one of the constants of POLICY_STATUS_ACTIVE, POLICY_STATUS_INACTIVE, POLICY_STATUS_DELETED.
        Parameters:
        newStatus - the new status to set
      • setKey

        void setKey(PromotionPolicyKey key)
        Sets the key of this promotion policy
        Parameters:
        key - the key to be set