Interface RuleService

All Known Implementing Classes:
RuleServiceImpl

public interface RuleService
  • Method Details

    • findRuleById

      RuleDTO findRuleById(long id)
      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 identifier
      username - user accessing rule
      Returns:
      RuleDTO
      Throws:
      IllegalAccessException - when user doesn't have enough privileges to access rule
      org.exoplatform.commons.exception.ObjectNotFoundException - when rule with id isn't enabled or isn't found
    • findRuleByTitle

      RuleDTO findRuleByTitle(String ruleTitle)
      Find a RuleEntity by title
      Parameters:
      ruleTitle - : rule's title param
      Returns:
      an instance of RuleDTO
    • getRules

      List<RuleDTO> getRules(RuleFilter ruleFilter, String username, int offset, int limit)
      Get Rules accessible for a given user by filter using offset and limit.
      Parameters:
      ruleFilter - RuleFilter used to filter rules
      username - User name accessing Programs
      offset - Offset of result
      limit - Limit of result
      Returns:
      List of RuleDTO
    • getRules

      List<RuleDTO> getRules(RuleFilter ruleFilter, int offset, int limit)
      Get Rules by filter using offset and limit.
      Parameters:
      ruleFilter - RuleFilter used to filter rules
      offset - Offset of result
      limit - Limit of result
      Returns:
      List of RuleDTO
    • countRules

      int countRules(RuleFilter ruleFilter, String username)
      Parameters:
      ruleFilter - RuleFilter used to count associated rules
      username - User name accessing Programs
      Returns:
      count rules by filter accessible to a given user
    • countRules

      int countRules(RuleFilter ruleFilter)
      Parameters:
      ruleFilter - RuleFilter used 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:
      Integer got 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 delete
      username - User name of user attempting to delete a rule
      Returns:
      deleted RuleDTO
      Throws:
      IllegalAccessException - when user is not authorized to delete the rule
      org.exoplatform.commons.exception.ObjectNotFoundException - when the rule identified by its technical identifier is not found
    • deleteRuleById

      RuleDTO deleteRuleById(long ruleId)
      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.ObjectAlreadyExistsException, org.exoplatform.commons.exception.ObjectNotFoundException
      Add Rule to DB
      Parameters:
      ruleDTO - RuleDTO to create
      username - User name of user attempting to create a rule
      Returns:
      created RuleDTO
      Throws:
      IllegalAccessException - when user is not authorized to create a rule
      org.exoplatform.commons.ObjectAlreadyExistsException - when rule already exists
      org.exoplatform.commons.exception.ObjectNotFoundException - when program doesn't exists
    • createRule

      RuleDTO createRule(RuleDTO ruleDTO)
      Add Rule to DB
      Parameters:
      ruleDTO - RuleDTO to create
      Returns:
      created RuleDTO
    • updateRule

      RuleDTO updateRule(RuleDTO ruleDTO, String username) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
      Update Rule to DB
      Parameters:
      ruleDTO - RuleDTO to update
      username - User name of user attempting to update a rule
      Returns:
      updated RuleDTO
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when rule doesn't exists
      IllegalAccessException - 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
      Parameters:
      ruleDTO - RuleDTO to update
      Returns:
      updated RuleDTO
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when rule doesn't exists
    • getPrerequisiteRules

      List<RuleDTO> getPrerequisiteRules(long ruleId)
      Retrieve prerequisite rules to achieve in order to be gamified for a given rule by an earner
      Parameters:
      ruleId - RuleDTO identifier
      Returns:
      List of RuleDTO