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>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
Constructor and Description |
---|
TargetingCondition()
Constructor for TargetingCondition.
|
Modifier and Type | Method and Description |
---|---|
void |
addExcludedProfile(CustomerProfile aProfile)
Adds a customer profile to the exclusion list
|
void |
addExcludedProfileByKey(CustomerProfileKey aKey)
Adds a customer profile to the exclusion list
|
void |
addTargetedProfile(CustomerProfile aProfile)
Adds a customer profile to the targeted list
|
void |
addTargetedProfileByKey(CustomerProfileKey aKey)
Adds a customer profile to the targeted list by key
|
boolean |
evaluate(PromotionContext context)
The evaluate method is used to determine if the condition has been
satisfied successfully.
|
void |
fromXML(org.w3c.dom.Node node)
Transforms the XML node into its corresponding real Object.
|
java.util.Vector |
getExclusionKeys()
Return the excluded profile keys.
|
java.util.Vector |
getInclusionKeys()
Return the targeted profile keys.
|
boolean |
isTargeted(Customer customer)
Checks to see if a customer belongs to a customer profile targeted by
this condition
|
void |
removeExcludedProfile(CustomerProfile aProfile)
Removes a customer profile from the exclusion list.
|
void |
removeExcludedProfileByKey(CustomerProfileKey aKey)
Removes a customer profile from the exclusion list.
|
void |
removeTargetedProfile(CustomerProfile aProfile)
Removes a customer profile from the inclusion list.
|
void |
removeTargetedProfileByKey(CustomerProfileKey aKey)
Removes a customer profile from the targeted profile list
|
void |
reset()
Resets the inclusion and exclusion list associated with this targeting
condition
|
java.lang.String |
toXML()
Converts the object into its corresponding XML format representation.
|
public static final java.lang.String COPYRIGHT
public TargetingCondition()
public void reset()
public void removeTargetedProfileByKey(CustomerProfileKey aKey)
aKey
- the key of the customer profile to be removedpublic void removeExcludedProfileByKey(CustomerProfileKey aKey)
aKey
- key of the customer profile to be removed.public void removeTargetedProfile(CustomerProfile aProfile)
aProfile
- the customer profile to be removedpublic void removeExcludedProfile(CustomerProfile aProfile)
aProfile
- customer profile to be removedpublic void addTargetedProfileByKey(CustomerProfileKey aKey)
aKey
- the key of the customer profile to be addedpublic void addExcludedProfileByKey(CustomerProfileKey aKey)
aKey
- A key of the customer profile to be addedpublic void addTargetedProfile(CustomerProfile aProfile)
aProfile
- A customer profile to be addedpublic void addExcludedProfile(CustomerProfile aProfile)
aProfile
- customer profile to be removed.public boolean isTargeted(Customer customer) throws PromotionConditionEvaluationException
customer
- the customerPromotionConditionEvaluationException
- when there is an unexpected error during condition evaluationpublic boolean evaluate(PromotionContext context) throws PromotionConditionEvaluationException
Condition
evaluate
in interface Condition
context
- The PromotionContext.PromotionConditionEvaluationException
- This exception is thrown if the evaluation encounters
unexpected problems.com.ibm.commerce.marketing.promotion.condition.Condition#evaluate()
public void fromXML(org.w3c.dom.Node node) throws DeXMLizationException
XMLizable
fromXML
in interface XMLizable
node
- The node that represents an XMLizable objectDeXMLizationException
- when this process failsXMLizable.fromXML(Node)
public java.lang.String toXML() throws XMLizationException
XMLizable
toXML
in interface XMLizable
XMLizationException
- when this process failsXMLizable.toXML()
public java.util.Vector getInclusionKeys()
public java.util.Vector getExclusionKeys()