com.elasticpath.domain.rules
Interface RuleElement

All Superinterfaces:
EpDomain, Persistence, java.io.Serializable, ValueObject
All Known Subinterfaces:
RuleAction, RuleCondition, RuleEligibility
All Known Implementing Classes:
AbstractRuleActionImpl, AbstractRuleElementImpl, BrandConditionImpl, CartCategoryAmountDiscountActionImpl, CartCategoryPercentDiscountActionImpl, CartContainsItemsOfCategoryConditionImpl, CartCurrencyConditionImpl, CartNFreeSkusActionImpl, CartNthProductPercentDiscountActionImpl, CartProductAmountDiscountActionImpl, CartProductPercentDiscountActionImpl, CartSkuAmountDiscountActionImpl, CartSkuPercentDiscountActionImpl, CartSubtotalAmountDiscountActionImpl, CartSubtotalConditionImpl, CartSubtotalDiscountActionImpl, CartSubtotalPercentDiscountActionImpl, CatalogSkuAmountDiscountActionImpl, CatalogSkuPercentDiscountActionImpl, CustomerGroupEligibilityImpl, EveryoneEligibilityImpl, ExistingCustomerEligibilityImpl, FirstTimeBuyerEligibilityImpl, ProductAmountDiscountActionImpl, ProductCategoryConditionImpl, ProductConditionImpl, ProductInCartConditionImpl, ProductPercentDiscountActionImpl, ShippingAmountDiscountActionImpl, ShippingPercentDiscountActionImpl, SkuInCartConditionImpl

public interface RuleElement
extends ValueObject

A rule element is a component of a rule such as a condition and an action.


Method Summary
 void addParameter(RuleParameter ruleParameter)
          Add a parameter of this rule action.
 boolean appliesInScenario(int scenarioId)
          Check if this rule element is valid in the specified scenario.
 java.lang.String[] getAllowedExceptions()
          Return the array of the allowed RuleException types for the rule.
 java.lang.String getDisplayText()
          Returns the text for display to the user.
 java.util.Set getExceptions()
          Get the RuleException associated with this RuleCondition.
 java.lang.String getKind()
          Get the kind of this RuleElement (e.g.
 java.lang.String[] getParameterKeys()
          Return the array of the required parameter keys for the rule.
 java.util.Set getParameters()
          Get the parameters associated with this rule action.
 java.lang.String getRuleCode()
          Returns the Drools code corresponding to this RuleCondition.
 java.lang.String getType()
          Get the type of action, i.e.
 void setExceptions(java.util.Set ruleExceptions)
          Set the exceptions of this rule condition.
 void setKind(java.lang.String kind)
          Set the kind of this RuleElement (e.g.
 void setParameters(java.util.Set parameters)
          Set the parameters of this rule action.
 void setRuleId(long ruleId)
          Set the identifier for the rule that contains this action.
 void setType(java.lang.String type)
          Set the type of action.
 void validate()
          Checks that the rule set domain model is well formed.
 
Methods inherited from interface com.elasticpath.domain.Persistence
executeBeforePersistAction, getUidPk, isPersistent, setDefaultValues, setUidPk
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 

Method Detail

addParameter

void addParameter(RuleParameter ruleParameter)
Add a parameter of this rule action.

Parameters:
ruleParameter - a RuleParameter object

appliesInScenario

boolean appliesInScenario(int scenarioId)
Check if this rule element is valid in the specified scenario.

Parameters:
scenarioId - the Id of the scenario to check (defined in RuleScenarios)
Returns:
true if the rule element is applicable in the given scenario

getAllowedExceptions

java.lang.String[] getAllowedExceptions()
Return the array of the allowed RuleException types for the rule.

Returns:
an array of String of the allowed RuleException types for the rule.

getDisplayText

java.lang.String getDisplayText()
Returns the text for display to the user.

Returns:
user display text.

getExceptions

java.util.Set getExceptions()
Get the RuleException associated with this RuleCondition.

Returns:
the set of ruleExceptions

getKind

java.lang.String getKind()
Get the kind of this RuleElement (e.g. eligibility, condition, action).

Returns:
the kind

getParameterKeys

java.lang.String[] getParameterKeys()
Return the array of the required parameter keys for the rule.

Returns:
an array of String of the required parameter keys for the rule.

getParameters

java.util.Set getParameters()
Get the parameters associated with this rule action.

Returns:
the parameters

getRuleCode

java.lang.String getRuleCode()
                             throws EpDomainException
Returns the Drools code corresponding to this RuleCondition.

Returns:
the drools code
Throws:
EpDomainException - if the RuleCondition is not well formed

getType

java.lang.String getType()
Get the type of action, i.e. cartSubtotalAmountDiscountAction, productAmountDiscountAction and etc. Make sure it matches the bean id in spring configuration for the implementation of an action.

Returns:
the action type

setExceptions

void setExceptions(java.util.Set ruleExceptions)
Set the exceptions of this rule condition.

Parameters:
ruleExceptions - a set of RuleException objects.

setKind

void setKind(java.lang.String kind)
Set the kind of this RuleElement (e.g. eligibility, condition, action)

Parameters:
kind - the kind of the rule element

setParameters

void setParameters(java.util.Set parameters)
Set the parameters of this rule action.

Parameters:
parameters - a set of RuleParameter objects

setRuleId

void setRuleId(long ruleId)
Set the identifier for the rule that contains this action. (For traceablility)

Parameters:
ruleId - the id of the rule containing this action.

setType

void setType(java.lang.String type)
Set the type of action.

Parameters:
type - the type of action

validate

void validate()
              throws EpDomainException
Checks that the rule set domain model is well formed. For example, rule conditions must have all required parameters specified.

Throws:
EpDomainException - if the structure is not correct.