Class RuleServiceImpl
java.lang.Object
org.exoplatform.addons.gamification.service.configuration.RuleServiceImpl
- All Implemented Interfaces:
RuleService
-
Constructor Summary
ConstructorsConstructorDescriptionRuleServiceImpl(RuleStorage ruleStorage, org.exoplatform.services.listener.ListenerService listenerService) -
Method Summary
Modifier and TypeMethodDescriptionintcountAllRules(RuleFilter ruleFilter) createRule(RuleDTO ruleDTO) Add Rule to DBcreateRule(RuleDTO ruleDTO, String username) Add Rule to DBdeleteRuleById(Long ruleId, String username) Deletes an existing ruleGet all Rules from DBfindAllRules(int offset, int limit) Get all Rules using offset and limit.findEnabledRulesByEvent(String event) Find enable RuleEntity by titlefindEnableRuleByTitle(String ruleTitle) Find enable RuleEntity by titlefindRuleByEventAndDomain(String ruleTitle, long domainId) Find a RuleEntity by titlefindRuleById(long id) Get RuleEntity by idfindRuleByTitle(String ruleTitle) Find a RuleEntity by titleGet all active Rules from DBGet all Events from rulesgetAllRulesByDomain(long domainId) Get all Rules by Domain from DBGet all Rules by with null DomainDTO from DBgetRulesByFilter(RuleFilter ruleFilter, int offset, int limit) Get Rules by filter using offset and limit.longgetRulesTotalScoreByDomain(long domainId) updateRule(RuleDTO ruleDTO) Update Rule to DBupdateRule(RuleDTO ruleDTO, String username) Update Rule to DB
-
Constructor Details
-
RuleServiceImpl
public RuleServiceImpl(RuleStorage ruleStorage, org.exoplatform.services.listener.ListenerService listenerService)
-
-
Method Details
-
findEnableRuleByTitle
Description copied from interface:RuleServiceFind enable RuleEntity by title- Specified by:
findEnableRuleByTitlein interfaceRuleService- Parameters:
ruleTitle- : rule's title param- Returns:
- an instance of RuleDTO
- Throws:
IllegalArgumentException
-
findRuleById
Description copied from interface:RuleServiceGet RuleEntity by id- Specified by:
findRuleByIdin interfaceRuleService- Parameters:
id- : rule's id param- Returns:
- an instance of RuleDTO
- Throws:
IllegalArgumentException
-
findEnabledRulesByEvent
Description copied from interface:RuleServiceFind enable RuleEntity by title- Specified by:
findEnabledRulesByEventin interfaceRuleService- Parameters:
event- : rule's title param- Returns:
- an instance of RuleDTO
- Throws:
IllegalArgumentException
-
findRuleByTitle
Description copied from interface:RuleServiceFind a RuleEntity by title- Specified by:
findRuleByTitlein interfaceRuleService- Parameters:
ruleTitle- : rule's title param- Returns:
- an instance of RuleDTO
- Throws:
IllegalArgumentException
-
findRuleByEventAndDomain
public RuleDTO findRuleByEventAndDomain(String ruleTitle, long domainId) throws IllegalArgumentException Description copied from interface:RuleServiceFind a RuleEntity by title- Specified by:
findRuleByEventAndDomainin interfaceRuleService- Parameters:
ruleTitle- : rule's title paramdomainId- domain id- Returns:
- an instance of RuleDTO
- Throws:
IllegalArgumentException
-
findAllRules
Description copied from interface:RuleServiceGet all Rules from DB- Specified by:
findAllRulesin interfaceRuleService- Returns:
- RuleDTO list
-
findAllRules
Description copied from interface:RuleServiceGet all Rules using offset and limit.- Specified by:
findAllRulesin interfaceRuleService- Parameters:
offset- Offset of resultlimit- Limit of result- Returns:
ListofRuleDTO
-
getRulesByFilter
Description copied from interface:RuleServiceGet Rules by filter using offset and limit.- Specified by:
getRulesByFilterin interfaceRuleService- Parameters:
ruleFilter-RuleFilterused to filter rulesoffset- Offset of resultlimit- Limit of result- Returns:
ListofRuleDTO
-
countAllRules
- Specified by:
countAllRulesin interfaceRuleService- Parameters:
ruleFilter-RuleFilterused to count associated rules- Returns:
- count rules by filter
-
getActiveRules
Description copied from interface:RuleServiceGet all active Rules from DB- Specified by:
getActiveRulesin interfaceRuleService- Returns:
- RuleDTO list
-
getAllRulesByDomain
Description copied from interface:RuleServiceGet all Rules by Domain from DB- Specified by:
getAllRulesByDomainin interfaceRuleService- Parameters:
domainId- domain id- Returns:
- RuleDTO list
- Throws:
IllegalArgumentException
-
getAllRulesWithNullDomain
Description copied from interface:RuleServiceGet all Rules by with null DomainDTO from DB- Specified by:
getAllRulesWithNullDomainin interfaceRuleService- Returns:
- RuleDTO list
-
getAllEvents
Description copied from interface:RuleServiceGet all Events from rules- Specified by:
getAllEventsin interfaceRuleService- Returns:
- RuleDTO list
-
getRulesTotalScoreByDomain
public long getRulesTotalScoreByDomain(long domainId) - Specified by:
getRulesTotalScoreByDomainin interfaceRuleService- Parameters:
domainId- domain id- Returns:
- rules total scores that can be earned
-
deleteRuleById
public RuleDTO deleteRuleById(Long ruleId, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Deletes an existing rule- Specified by:
deleteRuleByIdin interfaceRuleService- Parameters:
ruleId- Rule technical identifier to deleteusername- User name of user attempting to delete a rule- Returns:
- deleted
RuleDTO - Throws:
IllegalAccessException- when user is not authorized to delete the ruleorg.exoplatform.commons.exception.ObjectNotFoundException- when the rule identified by its technical identifier is not found
-
createRule
public RuleDTO createRule(RuleDTO ruleDTO, String username) throws IllegalAccessException, org.exoplatform.commons.ObjectAlreadyExistsException Add Rule to DB- Specified by:
createRulein interfaceRuleService- Parameters:
ruleDTO-RuleDTOto createusername- User name of user attempting to create a rule- Returns:
- created
RuleDTO - Throws:
IllegalAccessException- when user is not authorized to create a ruleorg.exoplatform.commons.ObjectAlreadyExistsException- when rule already exists
-
createRule
Add Rule to DB- Specified by:
createRulein interfaceRuleService- Parameters:
ruleDTO-RuleDTOto create- Returns:
- created
RuleDTO
-
updateRule
public RuleDTO updateRule(RuleDTO ruleDTO, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Update Rule to DB- Specified by:
updateRulein interfaceRuleService- Parameters:
ruleDTO-RuleDTOto updateusername- User name of user attempting to update a rule- Returns:
- updated
RuleDTO - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when rule doesn't existsIllegalAccessException- when user sin't allowed to update chosen rule
-
updateRule
public RuleDTO updateRule(RuleDTO ruleDTO) throws org.exoplatform.commons.exception.ObjectNotFoundException Description copied from interface:RuleServiceUpdate Rule to DB- Specified by:
updateRulein interfaceRuleService- Parameters:
ruleDTO-RuleDTOto update- Returns:
- updated
RuleDTO - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- when rule doesn't exists
-