public class PromotionCodeCondition extends java.lang.Object implements Condition
PromotionCodeCondition
class is used to check if a
promotion code has been specified for the promotion under evaluation. If for
a Promotion
, the Promotion.isPromotionCodeRequired()
method
returns true, then the evaluate method of this class checks if a promotion
code has been specified for the promotion. If the
evaluate(PromotionContext)
method returns true, then the promotion
can continue evaluation to see if it can be applied to an order. If the
evaluate method returns false, then the promotion cannot be applied to the
order.
XML Snippet for PromotionCodeCondition:
<PromotionCodeCondition impl="com.ibm.commerce.marketing.promotion.condition.PromotionCodeCondition"/>
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
Constructor and Description |
---|
PromotionCodeCondition()
Default Constructor for PromotionCodeRequiredCondition.
|
Modifier and Type | Method and Description |
---|---|
boolean |
evaluate(PromotionContext context)
This method is used to check if a promotion code has been specified for
the promotion under evaluation (obtained from the passed PromotionContext
object).
|
void |
fromXML(org.w3c.dom.Node node)
Transforms the XML node into its corresponding real Object.
|
java.lang.String |
toXML()
Converts the object into its corresponding XML format representation.
|
public static final java.lang.String COPYRIGHT
public PromotionCodeCondition()
public boolean evaluate(PromotionContext context) throws PromotionConditionEvaluationException
PromotionContext.isCodeEnteredFor(Promotion)
method to do the
evaluation and return the boolean value obtained.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()