com.ibm.commerce.marketing.promotion.condition

Class TargetingCondition

  • java.lang.Object
    • com.ibm.commerce.marketing.promotion.condition.TargetingCondition
  • All Implemented Interfaces:
    Condition, XMLizable, java.io.Serializable


    public class TargetingCondition
    extends java.lang.Object
    implements Condition
    TargetingCondition specifies the customer profiles to which the promotion will apply. When a promotion is targeted, it targets a list of customer profiles (target groups). Only user who belongs to at least one of the targeted group can be qualified for that promotion. When no target customer profile is listed, it is assumed that everyone is targeted. An exclusion list can also be specified for a promotion so that customer who belongs to any of the customer profile in the exclusion list will not be eligible for that promotion.

    XML Snippet of TargetingCondition:

      <!-- Targeting condition based on customer segments defined in WebSphere Commerce -->
      <Targeting impl= "com.ibm.commerce.marketing.promotion.condition.TargetingCondition">
            <TargetedProfile>
                    <CustomerProfileKey>
                            <OwnerDN>o=Root Organization</OwnerDN>
                            <ProfileName>EmptyNester</ProfileName>
                    </CustomerProfileKey>
                    <CustomerProfileKey>
                            <OwnerDN>o=Root Organization</OwnerDN>
                            <ProfileName>DINK Couple</ProfileName>
                    </CustomerProfileKey>
            </TargetedProfile>
            <ExcludedProfile>
                    <CustomerProfileKey>
                            <OwnerDN>o=Root Organization</OwnerDN>
                            <ProfileName>Employee</ProfileName>
                    </CustomerProfileKey>
            </ExcludedProfile>
      </Targeting>
     
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • TargetingCondition

        public TargetingCondition()
        Constructor for TargetingCondition.
    • Method Detail

      • reset

        public void reset()
        Resets the inclusion and exclusion list associated with this targeting condition
      • removeTargetedProfileByKey

        public void removeTargetedProfileByKey(CustomerProfileKey aKey)
        Removes a customer profile from the targeted profile list
        Parameters:
        aKey - the key of the customer profile to be removed
      • removeExcludedProfileByKey

        public void removeExcludedProfileByKey(CustomerProfileKey aKey)
        Removes a customer profile from the exclusion list.
        Parameters:
        aKey - key of the customer profile to be removed.
      • removeTargetedProfile

        public void removeTargetedProfile(CustomerProfile aProfile)
        Removes a customer profile from the inclusion list.
        Parameters:
        aProfile - the customer profile to be removed
      • removeExcludedProfile

        public void removeExcludedProfile(CustomerProfile aProfile)
        Removes a customer profile from the exclusion list.
        Parameters:
        aProfile - customer profile to be removed
      • addTargetedProfileByKey

        public void addTargetedProfileByKey(CustomerProfileKey aKey)
        Adds a customer profile to the targeted list by key
        Parameters:
        aKey - the key of the customer profile to be added
      • addExcludedProfileByKey

        public void addExcludedProfileByKey(CustomerProfileKey aKey)
        Adds a customer profile to the exclusion list
        Parameters:
        aKey - A key of the customer profile to be added
      • addTargetedProfile

        public void addTargetedProfile(CustomerProfile aProfile)
        Adds a customer profile to the targeted list
        Parameters:
        aProfile - A customer profile to be added
      • addExcludedProfile

        public void addExcludedProfile(CustomerProfile aProfile)
        Adds a customer profile to the exclusion list
        Parameters:
        aProfile - customer profile to be removed.
      • isTargeted

        public boolean isTargeted(Customer customer)
                           throws PromotionConditionEvaluationException
        Checks to see if a customer belongs to a customer profile targeted by this condition
        Parameters:
        customer - the customer
        Returns:
        true if this customer belongs to a customer profile targeted by this condition, false otherwise
        Throws:
        PromotionConditionEvaluationException - when there is an unexpected error during condition evaluation
      • evaluate

        public boolean evaluate(PromotionContext context)
                         throws PromotionConditionEvaluationException
        Description copied from interface: Condition
        The evaluate method is used to determine if the condition has been satisfied successfully. If true is returned, the condition is considered satisfied. If false, the condition is considered not satisfied.
        Specified by:
        evaluate in interface Condition
        Parameters:
        context - The PromotionContext.
        Returns:
        true if the condition has been satisfied successfully. Returns false otherwise.
        Throws:
        PromotionConditionEvaluationException - This exception is thrown if the evaluation encounters unexpected problems.
        See Also:
        com.ibm.commerce.marketing.promotion.condition.Condition#evaluate()
      • getInclusionKeys

        public java.util.Vector getInclusionKeys()
        Return the targeted profile keys.
        Returns:
        A vector of included profile keys.
      • getExclusionKeys

        public java.util.Vector getExclusionKeys()
        Return the excluded profile keys.
        Returns:
        A vector of excluded profile keys.