com.elasticpath.service.rules
Interface RuleService

All Superinterfaces:
EpPersistenceService, EpService
All Known Implementing Classes:
RuleServiceImpl

public interface RuleService
extends EpPersistenceService

Provides rule engine-related services for each rule.


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.
 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 interface com.elasticpath.service.EpPersistenceService
getObject, getPersistenceEngine, setPersistenceEngine
 
Methods inherited from interface com.elasticpath.service.EpService
getElasticPath, setElasticPath
 

Method Detail

add

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

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

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

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

getAllActionsMap

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

Returns:
Map of scenario ids as Integers to the corresponding rule elements

getAllConditionsMap

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

Returns:
Map of scenario ids as Integers to the corresponding rule elements

getAllEligibilitiesMap

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

Returns:
Map of scenario ids as Integers to the corresponding rule elements

getAllExceptionsMap

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

Returns:
Map of scenario ids as Integers to the corresponding rule elements

load

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

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

remove

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

Parameters:
rule - the rule to remove
Throws:
EpServiceException - - in case of any errors

setAllActions

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

Parameters:
actions - all the avaiable actions.

setAllConditions

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

Parameters:
conditions - all the avaiable conditions.

setAllEligibilities

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

Parameters:
eligibilities - all the avaiable eligibility conditions.

setAllExceptions

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

Parameters:
exceptions - all the avaiable actions.

setRuleSetService

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

Parameters:
ruleSetService - the rule set service.

update

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

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.