Package io.meeds.gamification.service
Interface RuleService
- All Known Implementing Classes:
RuleServiceImpl
public interface RuleService
-
Method Summary
Modifier and TypeMethodDescriptionintcountActiveRules(long programId) Returns the count of active rules of a given program identified by its id.intcountRules(RuleFilter ruleFilter) intcountRules(RuleFilter ruleFilter, String username) createRule(RuleDTO ruleDTO) Add Rule to DBcreateRule(RuleDTO ruleDTO, String username) Add Rule to DBdeleteRuleById(long ruleId) Deletes an existing ruledeleteRuleById(long ruleId, String username) Deletes an existing rulefindRuleById(long id) Get RuleEntity by idfindRuleById(long id, String username) findRuleByTitle(String ruleTitle) Find a RuleEntity by titlegetPrerequisiteRules(long ruleId) Retrieve prerequisite rules to achieve in order to be gamified for a given rule by an earnergetRules(RuleFilter ruleFilter, int offset, int limit) Get Rules by filter using offset and limit.getRules(RuleFilter ruleFilter, String username, int offset, int limit) Get Rules accessible for a given user by filter using offset and limit.default RuleDTOupdateRule(RuleDTO ruleDTO) Update Rule to DBupdateRule(RuleDTO ruleDTO, String username) Update Rule to DB
-
Method Details
-
findRuleById
Get RuleEntity by id- Parameters:
id- : rule's id param- Returns:
- an instance of RuleDTO
-
findRuleById
RuleDTO findRuleById(long id, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException - Parameters:
id- rule technical identifierusername- user accessing rule- Returns:
RuleDTO- Throws:
IllegalAccessException- when user doesn't have enough privileges to access ruleorg.exoplatform.commons.exception.ObjectNotFoundException- when rule with id isn't enabled or isn't found
-
findRuleByTitle
Find a RuleEntity by title- Parameters:
ruleTitle- : rule's title param- Returns:
- an instance of RuleDTO
-
getRules
Get Rules accessible for a given user by filter using offset and limit.- Parameters:
ruleFilter-RuleFilterused to filter rulesusername- User name accessing Programsoffset- Offset of resultlimit- Limit of result- Returns:
ListofRuleDTO
-
getRules
Get Rules by filter using offset and limit.- Parameters:
ruleFilter-RuleFilterused to filter rulesoffset- Offset of resultlimit- Limit of result- Returns:
ListofRuleDTO
-
countRules
- Parameters:
ruleFilter-RuleFilterused to count associated rulesusername- User name accessing Programs- Returns:
- count rules by filter accessible to a given user
-
countRules
- Parameters:
ruleFilter-RuleFilterused to count associated rules- Returns:
- count rules by filter
-
countActiveRules
int countActiveRules(long programId) Returns the count of active rules of a given program identified by its id. The list of active rules corresponds to enabled rules which started or is upcoming.- Parameters:
programId- Program technical identifier- Returns:
Integergot active rules count
-
deleteRuleById
RuleDTO deleteRuleById(long ruleId, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Deletes an existing rule- 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
-
deleteRuleById
Deletes an existing rule- Parameters:
ruleId- Rule technical identifier to delete- Returns:
- deleted
RuleDTO
-
createRule
RuleDTO createRule(RuleDTO ruleDTO, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Add Rule to DB- 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.exception.ObjectNotFoundException- when program doesn't exists
-
createRule
Add Rule to DB -
updateRule
RuleDTO updateRule(RuleDTO ruleDTO, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Update Rule to DB- 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
default RuleDTO updateRule(RuleDTO ruleDTO) throws org.exoplatform.commons.exception.ObjectNotFoundException Update Rule to DB -
getPrerequisiteRules
Retrieve prerequisite rules to achieve in order to be gamified for a given rule by an earner
-