com.elasticpath.service.rules.impl
Class RuleServiceImpl

java.lang.Object
  extended by com.elasticpath.service.impl.AbstractEpServiceImpl
      extended by com.elasticpath.service.impl.AbstractEpPersistenceServiceImpl
          extended by com.elasticpath.service.rules.impl.RuleServiceImpl
All Implemented Interfaces:
EpPersistenceService, EpService, RuleService

public class RuleServiceImpl
extends AbstractEpPersistenceServiceImpl
implements RuleService

Provides Rule Engine related services.


Constructor Summary
RuleServiceImpl()
           
 
Method Summary
 Rule add(Rule rule)
          Adds the given rule.
 Rule get(long ruleUid)
          Get the rule with the given UID.
 java.util.Map getAllActionsMap()
          Get all the available actions configured in the system.
 java.util.Map getAllConditionsMap()
          Get all the available conditions configured in the system.
 java.util.Map getAllEligibilitiesMap()
          Get all the available eligibility conditions configured in the system.
 java.util.Map getAllExceptionsMap()
          Get all the avaiable exceptions configured in the system.
 java.lang.Object getObject(long uid)
          Generic get method for all persistable domain models.
 Rule load(long ruleUid)
          Load the rule with the given UID.
 void remove(Rule rule)
          Delete the rule.
 void setAllActions(java.util.List actions)
          Set all the avaiable actions configured in the system.
 void setAllConditions(java.util.List conditions)
          Set all the avaiable conditions configured in the system.
 void setAllEligibilities(java.util.List eligibilities)
          Set all the avaiable eligibility conditions configured in the system.
 void setAllExceptions(java.util.List exceptions)
          Set all the avaiable exceptions configured in the system.
 void setRuleSetService(RuleSetService ruleSetService)
          Set the rule set service.
 void update(Rule rule)
          Updates the given rule.
 
Methods inherited from class com.elasticpath.service.impl.AbstractEpPersistenceServiceImpl
getPersistenceEngine, setPersistenceEngine
 
Methods inherited from class com.elasticpath.service.impl.AbstractEpServiceImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.service.EpPersistenceService
getPersistenceEngine, setPersistenceEngine
 
Methods inherited from interface com.elasticpath.service.EpService
getElasticPath, setElasticPath
 

Constructor Detail

RuleServiceImpl

public RuleServiceImpl()
Method Detail

add

public Rule add(Rule rule)
         throws DuplicateNameException,
                DuplicatePromoCodeException
Adds the given rule.

Specified by:
add in interface RuleService
Parameters:
rule - the rule to add
Returns:
the persisted instance of rule.
Throws:
DuplicateNameException - - if the specified promoCode is already in use.
DuplicatePromoCodeException - - if the specified promoCode is already in use.

get

public Rule get(long ruleUid)
         throws EpServiceException
Get the rule with the given UID. Return null if no matching record exists.

Specified by:
get in interface RuleService
Parameters:
ruleUid - the rule UID
Returns:
the rule if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getAllActionsMap

public java.util.Map getAllActionsMap()
Get all the available actions configured in the system.

Specified by:
getAllActionsMap in interface RuleService
Returns:
Map of scenario ids as Integers to the corresponding rule elements

getAllConditionsMap

public java.util.Map getAllConditionsMap()
Get all the available conditions configured in the system.

Specified by:
getAllConditionsMap in interface RuleService
Returns:
Map of scenario ids as Integers to the corresponding rule elements

getAllEligibilitiesMap

public java.util.Map getAllEligibilitiesMap()
Get all the available eligibility conditions configured in the system.

Specified by:
getAllEligibilitiesMap in interface RuleService
Returns:
Map of scenario ids as Integers to the corresponding rule elements

getAllExceptionsMap

public java.util.Map getAllExceptionsMap()
Get all the avaiable exceptions configured in the system.

Specified by:
getAllExceptionsMap in interface RuleService
Returns:
Map of scenario ids as Integers to the corresponding rule elements

getObject

public java.lang.Object getObject(long uid)
                           throws EpServiceException
Generic get method for all persistable domain models.

Specified by:
getObject in interface EpPersistenceService
Parameters:
uid - the persisted instance uid
Returns:
the persisted instance if exists, otherwise null
Throws:
EpServiceException - - in case of any errors

load

public Rule load(long ruleUid)
          throws EpServiceException
Load the rule with the given UID. Throw an unrecoverable exception if there is no matching database row.

Specified by:
load in interface RuleService
Parameters:
ruleUid - the rule UID
Returns:
the rule if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

remove

public void remove(Rule rule)
            throws EpServiceException
Delete the rule.

Specified by:
remove in interface RuleService
Parameters:
rule - the rule to remove
Throws:
EpServiceException - - in case of any errors

setAllActions

public void setAllActions(java.util.List actions)
Set all the avaiable actions configured in the system.

Specified by:
setAllActions in interface RuleService
Parameters:
actions - all the avaiable actions.

setAllConditions

public void setAllConditions(java.util.List conditions)
Set all the avaiable conditions configured in the system.

Specified by:
setAllConditions in interface RuleService
Parameters:
conditions - all the avaiable conditions.

setAllEligibilities

public void setAllEligibilities(java.util.List eligibilities)
Set all the avaiable eligibility conditions configured in the system.

Specified by:
setAllEligibilities in interface RuleService
Parameters:
eligibilities - all the avaiable eligibility conditions.

setAllExceptions

public void setAllExceptions(java.util.List exceptions)
Set all the avaiable exceptions configured in the system.

Specified by:
setAllExceptions in interface RuleService
Parameters:
exceptions - all the avaiable actions.

setRuleSetService

public void setRuleSetService(RuleSetService ruleSetService)
Set the rule set service.

Specified by:
setRuleSetService in interface RuleService
Parameters:
ruleSetService - the rule set service.

update

public void update(Rule rule)
            throws DuplicateNameException,
                   DuplicatePromoCodeException
Updates the given rule.

Specified by:
update in interface RuleService
Parameters:
rule - the rule to update]
Throws:
DuplicateNameException - - if the specified promoCode is already in use.
DuplicatePromoCodeException - - if the specified promoCode is already in use.