com.ibm.commerce.marketing.promotion.condition

Class PromotionCodeCondition

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


    public class PromotionCodeCondition
    extends java.lang.Object
    implements Condition
    The 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"/>
     
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
    • Constructor Summary

      Constructors 
      Constructor and Description
      PromotionCodeCondition()
      Default Constructor for PromotionCodeRequiredCondition.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      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.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

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

      • PromotionCodeCondition

        public PromotionCodeCondition()
        Default Constructor for PromotionCodeRequiredCondition.
    • Method Detail

      • evaluate

        public boolean evaluate(PromotionContext context)
                         throws PromotionConditionEvaluationException
        This method is used to check if a promotion code has been specified for the promotion under evaluation (obtained from the passed PromotionContext object). It calls the PromotionContext.isCodeEnteredFor(Promotion) method to do the evaluation and return the boolean value obtained.
        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()