public class OnlyOnePromotionGovernedByThisPoliceAppliesPolicy extends java.lang.Object implements PromotionPolicy
XML Snippet:
<PromotionPolicy impl="com.ibm.commerce.marketing.promotion.policy.OnlyOnePromotionGovernedByThisPoliceAppliesPolicy">
<PromotionPolicyKey>
<PolicyName>Unique Name for the policy</PolicyName>
<StoreKey>
<DN>o=root organization</DN>
<Identifier>BlueStore 202</Identifier>
</StoreKey>
</PromotionPolicyKey>
<!-- Active, Inactive or Deleted -->
<Status>Active</Status>
</PromotionPolicy>
POLICY_STATUS_ACTIVE, POLICY_STATUS_DELETED, POLICY_STATUS_INACTIVE| Constructor and Description |
|---|
OnlyOnePromotionGovernedByThisPoliceAppliesPolicy()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
apply(PromotionContext context,
PromotionExecutionRecord record)
This method enforces the promotion policy.
|
void |
fromXML(org.w3c.dom.Node anXMLNode)
Transforms the XML node into its corresponding real Object.
|
java.lang.String |
getDescription(java.util.Locale locale,
int type)
Returns the description of the promotion policy based on its type and
locale.
|
PromotionPolicyKey |
getKey()
Returns the key of this promotion policy
|
int |
getStatus()
Returns the status of this promotion policy
|
void |
setKey(PromotionPolicyKey akey)
Sets the key of this promotion policy
|
void |
setStatus(int newStatus)
Sets the status of a promotion policy.
|
java.lang.String |
toXML()
Converts the object into its corresponding XML format representation.
|
public OnlyOnePromotionGovernedByThisPoliceAppliesPolicy()
public PromotionPolicyKey getKey()
PromotionPolicygetKey in interface PromotionPolicyPromotionPolicy.getKey()public java.lang.String getDescription(java.util.Locale locale,
int type)
PromotionPolicygetDescription in interface PromotionPolicylocale - 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.PromotionPolicy.getDescription(Locale,
int)public boolean apply(PromotionContext context, PromotionExecutionRecord record) throws PromotionPolicyApplicationException
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.apply in interface PromotionPolicycontext - PromotionContext, created and passed to this policy by the enginerecord - 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 errorPromotionPolicy.apply(PromotionContext,
PromotionExecutionRecord)public int getStatus()
PromotionPolicygetStatus in interface PromotionPolicyPOLICY_STATUS_ACTIVE, POLICY_STATUS_INACTIVE,
POLICY_STATUS_DELETED.PromotionPolicy.getStatus()public void setStatus(int newStatus)
PromotionPolicyPOLICY_STATUS_ACTIVE, POLICY_STATUS_INACTIVE, POLICY_STATUS_DELETED.setStatus in interface PromotionPolicynewStatus - the new status to setPromotionPolicy.setStatus(int)public void setKey(PromotionPolicyKey akey)
PromotionPolicysetKey in interface PromotionPolicyakey - the key to be setPromotionPolicy.setKey(PromotionPolicyKey)public java.lang.String toXML()
throws XMLizationException
XMLizabletoXML in interface XMLizableXMLizationException - when this process failsXMLizable.toXML()public void fromXML(org.w3c.dom.Node anXMLNode)
throws DeXMLizationException
XMLizablefromXML in interface XMLizableanXMLNode - The node that represents an XMLizable objectDeXMLizationException - when this process failsXMLizable.fromXML(Node)