Class ChallengeServiceImpl
java.lang.Object
org.exoplatform.addons.gamification.service.configuration.ChallengeServiceImpl
- All Implemented Interfaces:
ChallengeService
-
Constructor Summary
ConstructorsConstructorDescriptionChallengeServiceImpl(ChallengeStorage challengeStorage, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.services.listener.ListenerService listenerService) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear challenges cache.intcountChallengesByFilterAndUser(RuleFilter challengeFilter, String username) Count all challenges by user and a selected domain identified by its technical idcreateChallenge(Challenge challenge) Creates a new challengecreateChallenge(Challenge challenge, String username) Creates a new challengevoiddeleteChallenge(Long challengeId, String username) Retrieves all challenges by user.getChallengeById(long challengeId) Retrieves a challenge identified by its technical identifier.getChallengeById(long challengeId, String username) Retrieves a challenge identified by its technical identifier.getChallengesByFilterAndUser(RuleFilter challengeFilter, int offset, int limit, String username) Retrieves all challenges by user.updateChallenge(Challenge challenge, String username) Updates an existing challenge
-
Constructor Details
-
ChallengeServiceImpl
public ChallengeServiceImpl(ChallengeStorage challengeStorage, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.services.listener.ListenerService listenerService)
-
-
Method Details
-
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
Description copied from interface:ChallengeServiceCreates a new challenge- Specified by:
createChallengein interfaceChallengeService- Parameters:
challenge-Challengeobject to create- Returns:
- created
Challengewith generated technical identifier
-
getChallengeById
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
-
getChallengeById
Description copied from interface:ChallengeServiceRetrieves a challenge identified by its technical identifier.- Specified by:
getChallengeByIdin interfaceChallengeService- Parameters:
challengeId- technical identifier of a challenge- Returns:
- A
Challengeobject
-
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- User name updating challenge- Returns:
- updated
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
-
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
-
getChallengesByFilterAndUser
public List<Challenge> getChallengesByFilterAndUser(RuleFilter challengeFilter, int offset, int limit, String username) Description copied from interface:ChallengeServiceRetrieves all challenges by user.- Specified by:
getChallengesByFilterAndUserin interfaceChallengeService- Parameters:
challengeFilter-RuleFilterused to filter challengesoffset- index of the searchlimit- limit of results to returnusername- User name accessing challenges- Returns:
- A
<Challenge>object
-
countChallengesByFilterAndUser
Description copied from interface:ChallengeServiceCount all challenges by user and a selected domain identified by its technical id- Specified by:
countChallengesByFilterAndUserin interfaceChallengeService- Parameters:
challengeFilter-RuleFilterused to filter challengesusername- Username accessing challenges- Returns:
- challenges count
-
clearUserChallengeCache
public void clearUserChallengeCache()Description copied from interface:ChallengeServiceclear challenges cache.- Specified by:
clearUserChallengeCachein interfaceChallengeService
-