Interface ChallengeService

    • Method Detail

      • createChallenge

        Challenge createChallenge​(Challenge challenge)
        Creates a new challenge
        Parameters:
        challenge - Challenge object to create
        Returns:
        created Challenge with generated technical identifier
        Throws:
        IllegalAccessException - when user is not authorized to create a challenge for the designated owner defined in object
      • getChallengeById

        Challenge getChallengeById​(long challengeId,
                                   String username)
                            throws IllegalAccessException
        Retrieves a challenge identified by its technical identifier.
        Parameters:
        challengeId - technical identifier of a challenge
        username - User name accessing challenge
        Returns:
        A Challenge object
        Throws:
        IllegalAccessException - when user is not authorized to access challenge
      • updateChallenge

        Challenge updateChallenge​(Challenge challenge,
                                  String username)
                           throws IllegalArgumentException,
                                  org.exoplatform.commons.exception.ObjectNotFoundException,
                                  IllegalAccessException
        Updates an existing challenge
        Parameters:
        challenge - Challenge object to update
        username - Username updating challenge
        Throws:
        IllegalArgumentException - when user is not authorized to update the challenge
        org.exoplatform.commons.exception.ObjectNotFoundException - when the challenge identified by its technical identifier is not found
        IllegalAccessException - when user is not authorized to create a challenge for the designated owner defined in object
      • canAddChallenge

        boolean canAddChallenge()
        Return a boolean that indicates if the current user can add a challenge or not
        Returns:
        if the user can add a challenge or not
      • getAllChallengesByUser

        List<Challenge> getAllChallengesByUser​(int offset,
                                               int limit,
                                               String username)
                                        throws Exception
        Retrieves all challenges by user.
        Parameters:
        offset - Offset
        limit - Limit
        username - Username accessing challenge
        Returns:
        A object
        Throws:
        IllegalAccessException - when user is not authorized to access challenges
        Exception - can't get list of spaces
      • clearUserChallengeCache

        void clearUserChallengeCache()
        clear challenges cache.
      • deleteChallenge

        void deleteChallenge​(Long challengeId,
                             String username)
                      throws IllegalAccessException,
                             org.exoplatform.commons.exception.ObjectNotFoundException
        Retrieves all challenges by user.
        Parameters:
        challengeId - Offset
        username - Username who want to delete challenge
        Throws:
        IllegalAccessException - when user is not authorized to delete challenges
        org.exoplatform.commons.exception.ObjectNotFoundException - challenge not found
        IllegalArgumentException - when challenge has announcements or did not ended yet