public class GroupExclusivenessEnforcementPolicy extends java.lang.Object implements PromotionPolicy
XML Snippet:
<PromotionPolicy impl="com.ibm.commerce.marketing.promotion.policy.GroupExclusivenessEnforcementPolicy"> <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 |
---|
GroupExclusivenessEnforcementPolicy()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
apply(PromotionContext context,
PromotionExecutionRecord record)
Enforces the exclusivity of promotions at the group level.
|
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 GroupExclusivenessEnforcementPolicy()
public PromotionPolicyKey getKey()
PromotionPolicy
getKey
in interface PromotionPolicy
PromotionPolicy.getKey()
public java.lang.String getDescription(java.util.Locale locale, int type)
PromotionPolicy
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
.PromotionPolicy.getDescription(Locale,
int)
public boolean apply(PromotionContext context, PromotionExecutionRecord record) throws PromotionPolicyApplicationException
context
parameter passed and checks if the promotion has
group exclusiveness policy set. If this policy is set, it gets the other
promotions from the PromotionArgument object (referenced using
PromotionContext context
) and for each such promotion,
checks for two things: record
parameter.record
's state is
set to eliminated and this policy is set to have been violated in the
record
; false is returned. context
, checks if their group name is the same as the group
name of the promotion under evaluation and marks them as not applicable
to the current order; in other words, it enforces the group exclusiveness
setting on the promotion under evaluation by marking all the other
promotions as not applicable.apply
in interface PromotionPolicy
context
- 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()
PromotionPolicy
getStatus
in interface PromotionPolicy
POLICY_STATUS_ACTIVE
, POLICY_STATUS_INACTIVE
,
POLICY_STATUS_DELETED
.PromotionPolicy.getStatus()
public void setStatus(int newStatus)
PromotionPolicy
POLICY_STATUS_ACTIVE
, POLICY_STATUS_INACTIVE
, POLICY_STATUS_DELETED
.setStatus
in interface PromotionPolicy
newStatus
- the new status to setPromotionPolicy.setStatus(int)
public void setKey(PromotionPolicyKey akey)
PromotionPolicy
setKey
in interface PromotionPolicy
akey
- the key to be setPromotionPolicy.setKey(PromotionPolicyKey)
public java.lang.String toXML() throws XMLizationException
XMLizable
toXML
in interface XMLizable
XMLizationException
- when this process failsXMLizable.toXML()
public void fromXML(org.w3c.dom.Node anXMLNode) throws DeXMLizationException
XMLizable
fromXML
in interface XMLizable
anXMLNode
- The node that represents an XMLizable objectDeXMLizationException
- when this process failsXMLizable.fromXML(Node)