Class ChallengeServiceImpl
- java.lang.Object
-
- org.exoplatform.addons.gamification.service.configuration.ChallengeServiceImpl
-
- All Implemented Interfaces:
ChallengeService
public class ChallengeServiceImpl extends Object implements ChallengeService
-
-
Constructor Summary
Constructors Constructor Description ChallengeServiceImpl(RuleStorage challengeStorage, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.container.xml.InitParams params)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanAddChallenge()Return a boolean that indicates if the current user can add a challenge or notvoidclearUserChallengeCache()clear challenges cache.ChallengecreateChallenge(Challenge challenge)Creates a new challengeChallengecreateChallenge(Challenge challenge, String username)Creates a new challengevoiddeleteChallenge(Long challengeId, String username)Retrieves all challenges by user.List<Challenge>getAllChallengesByUser(int offset, int limit, String userName)Retrieves all challenges by user.ChallengegetChallengeById(long challengeId, String username)Retrieves a challenge identified by its technical identifier.ChallengeupdateChallenge(Challenge challenge, String username)Updates an existing challenge
-
-
-
Constructor Detail
-
ChallengeServiceImpl
public ChallengeServiceImpl(RuleStorage challengeStorage, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.container.xml.InitParams params)
-
-
Method Detail
-
createChallenge
public Challenge createChallenge(Challenge challenge, String username) throws IllegalAccessException
Description copied from interface:ChallengeServiceCreates a new challenge- Specified by:
createChallengein interfaceChallengeService- Parameters:
challenge-Challengeobject to createusername- User name creating challenge- Returns:
- created
Challengewith generated technical identifier - Throws:
IllegalAccessException- when user is not authorized to create a challenge for the designated owner defined in object
-
createChallenge
public Challenge createChallenge(Challenge challenge)
Description copied from interface:ChallengeServiceCreates a new challenge- Specified by:
createChallengein interfaceChallengeService- Parameters:
challenge-Challengeobject to create- Returns:
- created
Challengewith generated technical identifier
-
getChallengeById
public Challenge getChallengeById(long challengeId, String username) throws IllegalAccessException
Description copied from interface:ChallengeServiceRetrieves a challenge identified by its technical identifier.- Specified by:
getChallengeByIdin interfaceChallengeService- Parameters:
challengeId- technical identifier of a challengeusername- User name accessing challenge- Returns:
- A
Challengeobject - Throws:
IllegalAccessException- when user is not authorized to access challenge
-
updateChallenge
public Challenge updateChallenge(Challenge challenge, String username) throws IllegalArgumentException, org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException
Description copied from interface:ChallengeServiceUpdates an existing challenge- Specified by:
updateChallengein interfaceChallengeService- Parameters:
challenge-Challengeobject to updateusername- Username updating challenge- Throws:
IllegalArgumentException- when user is not authorized to update the challengeorg.exoplatform.commons.exception.ObjectNotFoundException- when the challenge identified by its technical identifier is not foundIllegalAccessException- when user is not authorized to create a challenge for the designated owner defined in object
-
canAddChallenge
public boolean canAddChallenge()
Description copied from interface:ChallengeServiceReturn a boolean that indicates if the current user can add a challenge or not- Specified by:
canAddChallengein interfaceChallengeService- Returns:
- if the user can add a challenge or not
-
getAllChallengesByUser
public List<Challenge> getAllChallengesByUser(int offset, int limit, String userName) throws Exception
Description copied from interface:ChallengeServiceRetrieves all challenges by user.- Specified by:
getAllChallengesByUserin interfaceChallengeService- Parameters:
offset- Offsetlimit- LimituserName- Username accessing challenge- Returns:
- A
object - Throws:
IllegalAccessException- when user is not authorized to access challengesException- can't get list of spaces
-
clearUserChallengeCache
public void clearUserChallengeCache()
Description copied from interface:ChallengeServiceclear challenges cache.- Specified by:
clearUserChallengeCachein interfaceChallengeService
-
deleteChallenge
public void deleteChallenge(Long challengeId, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
Description copied from interface:ChallengeServiceRetrieves all challenges by user.- Specified by:
deleteChallengein interfaceChallengeService- Parameters:
challengeId- Offsetusername- Username who want to delete challenge- Throws:
IllegalAccessException- when user is not authorized to delete challengesorg.exoplatform.commons.exception.ObjectNotFoundException- challenge not found
-
-