com.elasticpath.service.rules.impl
Class RuleSetServiceImpl

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

public class RuleSetServiceImpl
extends AbstractEpPersistenceServiceImpl
implements RuleSetService

Provides Rule Engine related services.


Constructor Summary
RuleSetServiceImpl()
           
 
Method Summary
 RuleSet add(RuleSet ruleSet)
          Adds the given ruleSet.
 java.util.List findByModifiedDate(java.util.Date date)
          Retrieves list of RuleSets where the last modified date is later than the specified date.
 RuleSet findByScenarioId(int scenarioId)
          Find the rule set by its scenario id.
 RuleSet get(long ruleSetUid)
          Get the ruleSet with the given UID.
 java.lang.Object getObject(long uid)
          Generic get method for all persistable domain models.
 TimeService getTimeService()
          Returns the time service.
 java.util.List list()
          List all ruleSets stored in the database.
 RuleSet load(long ruleSetUid)
          Load the ruleSet with the given UID.
 void remove(RuleSet ruleSet)
          Delete the ruleSet.
 void setTimeService(TimeService timeService)
          Sets the time service.
 void update(RuleSet ruleSet)
          Updates the given ruleset.
 void updateLastModifiedTime(RuleSet ruleSet)
          Update the ruleSet's last modified timestamp.
 
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

RuleSetServiceImpl

public RuleSetServiceImpl()
Method Detail

add

public RuleSet add(RuleSet ruleSet)
            throws EpServiceException
Adds the given ruleSet.

Specified by:
add in interface RuleSetService
Parameters:
ruleSet - the ruleSet to add
Returns:
the persisted instance of ruleSet
Throws:
EpServiceException - - in case of any errors

findByModifiedDate

public java.util.List findByModifiedDate(java.util.Date date)
Retrieves list of RuleSets where the last modified date is later than the specified date.

Specified by:
findByModifiedDate in interface RuleSetService
Parameters:
date - date to compare with the last modified date
Returns:
list of RuleSet whose last modified date is later than the specified date

findByScenarioId

public RuleSet findByScenarioId(int scenarioId)
                         throws EpServiceException
Find the rule set by its scenario id.

Specified by:
findByScenarioId in interface RuleSetService
Parameters:
scenarioId - the id of the scenario (see Scenarios interface)
Returns:
the Rule Set if it exists, otherwise null
Throws:
EpServiceException - - in case of any errors

get

public RuleSet get(long ruleSetUid)
            throws EpServiceException
Get the ruleSet with the given UID. Return null if no matching record exists.

Specified by:
get in interface RuleSetService
Parameters:
ruleSetUid - the ruleSet UID
Returns:
the ruleSet if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

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

getTimeService

public TimeService getTimeService()
Returns the time service.

Returns:
the time service.

list

public java.util.List list()
                    throws EpServiceException
List all ruleSets stored in the database.

Specified by:
list in interface RuleSetService
Returns:
a list of ruleSets
Throws:
EpServiceException - - in case of any errors

load

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

Specified by:
load in interface RuleSetService
Parameters:
ruleSetUid - the ruleSet UID
Returns:
the ruleSet if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

remove

public void remove(RuleSet ruleSet)
            throws EpServiceException
Delete the ruleSet.

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

setTimeService

public void setTimeService(TimeService timeService)
Sets the time service.

Parameters:
timeService - the time service

update

public void update(RuleSet ruleSet)
            throws EpServiceException
Updates the given ruleset.

Specified by:
update in interface RuleSetService
Parameters:
ruleSet - the ruleSet to update
Throws:
EpServiceException - - in case of any errors

updateLastModifiedTime

public void updateLastModifiedTime(RuleSet ruleSet)
Update the ruleSet's last modified timestamp.

Specified by:
updateLastModifiedTime in interface RuleSetService
Parameters:
ruleSet - the ruleSet whose timestamp is to be updated.