com.elasticpath.domain.rules.impl
Class AbstractRuleElementImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractPersistenceImpl
          extended by com.elasticpath.domain.impl.AbstractValueObjectImpl
              extended by com.elasticpath.domain.rules.impl.AbstractRuleElementImpl
All Implemented Interfaces:
EpDomain, Persistence, RuleElement, ValueObject, java.io.Serializable
Direct Known Subclasses:
AbstractRuleActionImpl, BrandConditionImpl, CartContainsItemsOfCategoryConditionImpl, CartCurrencyConditionImpl, CartSubtotalConditionImpl, CustomerGroupEligibilityImpl, EveryoneEligibilityImpl, ExistingCustomerEligibilityImpl, FirstTimeBuyerEligibilityImpl, ProductCategoryConditionImpl, ProductConditionImpl, ProductInCartConditionImpl, SkuInCartConditionImpl

public abstract class AbstractRuleElementImpl
extends AbstractValueObjectImpl
implements RuleElement

Abstract class with behaviour common to all rule elements.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          Serial version id.
 
Constructor Summary
AbstractRuleElementImpl()
           
 
Method Summary
 void addParameter(RuleParameter ruleParameter)
          Add a parameter of this rule condition.
 java.util.Set getExceptions()
          Get the RuleException objects associated with this RuleElement.
 java.lang.String getKind()
          Get the kind of this RuleElement (e.g.
 java.util.Set getParameters()
          Get the parameters associated with this rule condition.
 java.lang.String getType()
          Get the type of this rule element.
 void setDefaultValues()
          Sets default values.
 void setExceptions(java.util.Set ruleExceptions)
          Set the exceptions of this rule element.
 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 condition.
 void setRuleId(long ruleId)
          Set the identifier for the rule that contains this action.
 void setType(java.lang.String type)
          Set the type of element.
 void validate()
          Checks that the rule set domain model is well formed.
 
Methods inherited from class com.elasticpath.domain.impl.AbstractPersistenceImpl
executeBeforePersistAction, getUidPk, isPersistent, setUidPk
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEpDomainImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.domain.rules.RuleElement
appliesInScenario, getAllowedExceptions, getDisplayText, getParameterKeys, getRuleCode
 
Methods inherited from interface com.elasticpath.domain.Persistence
executeBeforePersistAction, getUidPk, isPersistent, setUidPk
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Serial version id.

See Also:
Constant Field Values
Constructor Detail

AbstractRuleElementImpl

public AbstractRuleElementImpl()
Method Detail

addParameter

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

Specified by:
addParameter in interface RuleElement
Parameters:
ruleParameter - a RuleParameter object

getExceptions

public java.util.Set getExceptions()
Get the RuleException objects associated with this RuleElement.

Specified by:
getExceptions in interface RuleElement
Returns:
the set of ruleExceptions

getKind

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

Specified by:
getKind in interface RuleElement
Returns:
the kind

getParameters

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

Specified by:
getParameters in interface RuleElement
Returns:
the parameters

getType

public java.lang.String getType()
Get the type of this rule element. (e.g. cartCategoryPercentDiscountAction. Should match spring bean factory bean id.)

Specified by:
getType in interface RuleElement
Returns:
the type

setDefaultValues

public void setDefaultValues()
Sets default values.

Specified by:
setDefaultValues in interface Persistence
Overrides:
setDefaultValues in class AbstractPersistenceImpl

setExceptions

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

Specified by:
setExceptions in interface RuleElement
Parameters:
ruleExceptions - a set of RuleException objects.

setKind

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

Specified by:
setKind in interface RuleElement
Parameters:
kind - the kind of the rule element

setParameters

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

Specified by:
setParameters in interface RuleElement
Parameters:
parameters - a set of RuleParameter objects

setRuleId

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

Specified by:
setRuleId in interface RuleElement
Parameters:
ruleId - the id of the rule containing this action.

setType

public void setType(java.lang.String type)
Set the type of element. (e.g. cartCategoryPercentDiscountAction. Should match bean name)

Specified by:
setType in interface RuleElement
Parameters:
type - the type of element

validate

public void validate()
              throws EpDomainException
Checks that the rule set domain model is well formed. For example, rule conditions must have all required parameters specified. Note: the parameter value of categoryId, productId and skuCode are allowed to be empty, which mean "ANY".

Specified by:
validate in interface RuleElement
Throws:
EpDomainException - if the structure is not correct.