Develop > Presentation layer > Customize promotions > Promotion engine customization > Customization scenarios > Overview of creating a new promotion type using existing promotion elements > Custom promotion types


Custom conditions

Custom conditions can be created and used to build a promotion. A custom condition must implement the com.ibm.commerce.marketing.promotion.condition.Condition interface, which is a subclass of XMLizable. Here is the definition of this interface:

package com.ibm.commerce.marketing.promotion.condition; 
import com.ibm.commerce.marketing.promotion.runtime.PromotionContext; import com.ibm.commerce.marketing.promotion.xml.*; 
public interface Condition extends XMLizable {

    /**
     * IBM copyright notice field.
     */
    public static final String COPYRIGHT =
          com.ibm.commerce.copyright.IBMCopyright.SHORT_COPYRIGHT; 
    boolean evaluate(PromotionContext context)
       throws PromotionConditionEvaluationException; }

The evaluate method is expected to return either true or false. If true, the condition is considered satisfied. If false, the condition is considered not satisfied and the promotion to which this custom condition belongs will not be applied.

All custom conditions must be thread safe and re-entrant.

Related reference

Custom promotion types