com.elasticpath.domain.rules.impl
Class CartSubtotalDiscountActionImpl

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
                  extended by com.elasticpath.domain.rules.impl.AbstractRuleActionImpl
                      extended by com.elasticpath.domain.rules.impl.CartSubtotalDiscountActionImpl
All Implemented Interfaces:
EpDomain, Persistence, RuleAction, RuleElement, ValueObject, java.io.Serializable

public class CartSubtotalDiscountActionImpl
extends AbstractRuleActionImpl
implements RuleAction

Rule action that discounts a product by a given amount.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          Serial version id.
 
Fields inherited from interface com.elasticpath.domain.rules.RuleAction
ACTION_KIND, DEFAULT_AGENDA_GROUP, SUBTOTAL_DEPENDENT_AGENDA_GROUP
 
Constructor Summary
CartSubtotalDiscountActionImpl()
           
 
Method Summary
 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()
          Return the text representation of this action for display to the user.
 java.lang.String[] getParameterKeys()
          Return an array of parameter keys required by this rule action.
 java.lang.String getRuleCode()
          Return the Drools code corresponding to this action.
 void validate()
          Checks that the rule set domain model is well formed.
 
Methods inherited from class com.elasticpath.domain.rules.impl.AbstractRuleActionImpl
getAgendaGroup, getSalience, setAgendaGroup, setSalience
 
Methods inherited from class com.elasticpath.domain.rules.impl.AbstractRuleElementImpl
addParameter, getExceptions, getKind, getParameters, getType, setDefaultValues, setExceptions, setKind, setParameters, setRuleId, setType
 
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.RuleAction
getAgendaGroup, getSalience, setAgendaGroup, setSalience
 
Methods inherited from interface com.elasticpath.domain.rules.RuleElement
addParameter, getExceptions, getKind, getParameters, getType, setExceptions, setKind, setParameters, setRuleId, setType
 
Methods inherited from interface com.elasticpath.domain.Persistence
executeBeforePersistAction, getUidPk, isPersistent, setDefaultValues, 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

CartSubtotalDiscountActionImpl

public CartSubtotalDiscountActionImpl()
Method Detail

appliesInScenario

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

Specified by:
appliesInScenario in interface RuleElement
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

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

Specified by:
getAllowedExceptions in interface RuleElement
Returns:
an array of String of the allowed RuleException types for the rule.

getDisplayText

public java.lang.String getDisplayText()
Return the text representation of this action for display to the user.

Specified by:
getDisplayText in interface RuleElement
Returns:
the text representation

getParameterKeys

public java.lang.String[] getParameterKeys()
Return an array of parameter keys required by this rule action.

Specified by:
getParameterKeys in interface RuleElement
Returns:
the parameter key array

getRuleCode

public java.lang.String getRuleCode()
                             throws EpDomainException
Return the Drools code corresponding to this action.

Specified by:
getRuleCode in interface RuleElement
Returns:
the Drools code
Throws:
EpDomainException - if the rule is not well formed

validate

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

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