com.elasticpath.domain.rules.impl
Class RuleSetImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractPersistenceImpl
          extended by com.elasticpath.domain.impl.AbstractEntityImpl
              extended by com.elasticpath.domain.rules.impl.RuleSetImpl
All Implemented Interfaces:
Entity, EpDomain, Persistence, RuleSet, java.io.Serializable

public class RuleSetImpl
extends AbstractEntityImpl
implements RuleSet

Represents a set of rules. This currently represents a set of promotion rules. When another rule set is introduced, this class should implement an abstract rule set and subclasses will implement specific rule sets such as promotion rule sets. Note that this rule set is specific to a particular collection of rules because of the import statements that those rules need.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          Serial version id.
 
Constructor Summary
RuleSetImpl()
           
 
Method Summary
 void addRule(Rule rule)
          Adds a rule to the rule set.
 java.util.Set getImports()
          Get the names of classes imported by this rule set.
 java.util.Date getLastModifiedDate()
          Returns the date when the rule set was last modified.
 java.lang.String getName()
          Get the name of this rule set.
 java.lang.String getRuleCode()
          Returns the Drools code corresponding to this rule set.
 java.util.Set getRules()
          Get the rules in this rule set.
 int getScenario()
          Get the id of the scenario that this rule set applies to.
 void setLastModifiedDate(java.util.Date lastModifiedDate)
          Set the date when the rule set was last modified.
 void setName(java.lang.String name)
          Set the name of this rule set.
 void setRules(java.util.Set rules)
          Set the rules in this rule set.
 void setScenario(int scenarioId)
          Set the scenario that this rule set applies to.
 void validate()
          Checks that the rule set domain model is well formed.
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEntityImpl
convertAttributeGroupAttributes, getGuid, setDefaultValues, setGuid
 
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.Entity
getGuid, setGuid
 
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

RuleSetImpl

public RuleSetImpl()
Method Detail

addRule

public void addRule(Rule rule)
Adds a rule to the rule set.

Specified by:
addRule in interface RuleSet
Parameters:
rule - the rule to add

getImports

public java.util.Set getImports()
Get the names of classes imported by this rule set.

Specified by:
getImports in interface RuleSet
Returns:
the set of imports (fully qualified class names)
See Also:
addImport

getLastModifiedDate

public java.util.Date getLastModifiedDate()
Returns the date when the rule set was last modified.

Specified by:
getLastModifiedDate in interface RuleSet
Returns:
the date when the rule set was last modified

getName

public java.lang.String getName()
Get the name of this rule set.

Specified by:
getName in interface RuleSet
Returns:
the name of this rule set.

getRuleCode

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

Specified by:
getRuleCode in interface RuleSet
Returns:
the rule code.
Throws:
EpDomainException - if the rule set is not well formed

getRules

public java.util.Set getRules()
Get the rules in this rule set.

Specified by:
getRules in interface RuleSet
Returns:
the rules

getScenario

public int getScenario()
Get the id of the scenario that this rule set applies to.

Specified by:
getScenario in interface RuleSet
Returns:
the scenario id (constant in RuleScenarios)

setLastModifiedDate

public void setLastModifiedDate(java.util.Date lastModifiedDate)
Set the date when the rule set was last modified.

Specified by:
setLastModifiedDate in interface RuleSet
Parameters:
lastModifiedDate - the date when the rule set was last modified

setName

public void setName(java.lang.String name)
Set the name of this rule set.

Specified by:
setName in interface RuleSet
Parameters:
name - the name of this rule set

setRules

public void setRules(java.util.Set rules)
Set the rules in this rule set.

Specified by:
setRules in interface RuleSet
Parameters:
rules - a set of Rule objects

setScenario

public void setScenario(int scenarioId)
Set the scenario that this rule set applies to.

Specified by:
setScenario in interface RuleSet
Parameters:
scenarioId - a constant in RuleScenarios.

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.

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