com.elasticpath.domain.rules
Interface RuleException

All Superinterfaces:
EpDomain, Persistence, java.io.Serializable, ValueObject
All Known Implementing Classes:
AbstractRuleExceptionImpl, CategoryExceptionImpl, ProductExceptionImpl, SkuExceptionImpl

public interface RuleException
extends ValueObject

Represents an exception that could be assoicate with a rule condition or rule action.


Method Summary
 void addParameter(RuleParameter ruleParameter)
          Add a parameter of this rule exception.
 boolean appliesInScenario(int scenarioId)
          Check if this rule element is valid in the specified scenario.
 java.lang.String getDisplayText()
          Returns the text for display to the user.
 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 exception.
 java.lang.String getParamValue(java.lang.String key)
          Returns the value of a parameter with the specified key.
 java.lang.String getType()
          Get the type of exception, i.e.
 void setParameters(java.util.Set parameters)
          Set the parameters of this rule exception.
 void setType(java.lang.String type)
          Set the type of exception.
 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 exception.

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

getDisplayText

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

Returns:
user display text.

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 exception.

Returns:
the parameters

getParamValue

java.lang.String getParamValue(java.lang.String key)
Returns the value of a parameter with the specified key.

Parameters:
key - The key of the parameter to be returned
Returns:
the value of the parameter with the specified key or "" if no matching parameter was found.

getType

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

Returns:
the exception type

setParameters

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

Parameters:
parameters - a set of RuleParameter objects

setType

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

Parameters:
type - the type of exception

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.