Package io.meeds.gamification.service
Interface ProgramService
- All Known Implementing Classes:
ProgramServiceImpl
public interface ProgramService
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleancanAddProgram(org.exoplatform.services.security.Identity aclIdentity) Check whether user can add programs or notbooleancanEditProgram(long programId, String username) Check whether user can edit program details or notbooleancanUseProgramColor(long programId, String color) Return true if the color isn't used by any other program, else return falsebooleancanViewProgram(long programId, String username) Check whether user can view program details or notintcountMemberPrograms(String username) intcountOwnedPrograms(String username) intcountPrograms(ProgramFilter programFilter) Count all Programs by filterintcountPrograms(ProgramFilter programFilter, String username) Count all Programs by filterintcreateProgram(ProgramDTO program) Creates a new ProgramcreateProgram(ProgramDTO program, org.exoplatform.services.security.Identity aclIdentity) Creates a new ProgramvoiddeleteProgramAvatarById(long programId, org.exoplatform.services.security.Identity aclIdentity) Delete program Avatar identified by program iddeleteProgramById(long programId, org.exoplatform.services.security.Identity aclIdentity) Deletes an existing Program by idvoiddeleteProgramCoverById(long programId, org.exoplatform.services.security.Identity aclIdentity) Delete program Cover identified by program idgetMemberProgramIds(String username, int offset, int limit) getOwnedProgramIds(String username, int offset, int limit) getProgramAvatarStream(long programId) Retrieves the program avatar identified by Program technical identifier.getProgramById(long programId) Retrieves a program identified by its technical identifier.getProgramById(long programId, String username) Retrieves a program identified by its technical identifier accessed by a usergetProgramByTitle(String programTitle) Find a Program by titlegetProgramCoverStream(long programId) Retrieves the program cover identified by Program technical identifier.getProgramIds(ProgramFilter programFilter, int offset, int limit) Gets Program Ids by filter.getProgramIds(ProgramFilter programFilter, String username, int offset, int limit) Gets Program Ids by filter.getPrograms(ProgramFilter programFilter, String username, int offset, int limit) Gets programs by filter.getPublicProgramIds(int offset, int limit) booleanisProgramMember(long programId, String username) Check whether user is member of program or notbooleanisProgramMember(long programId, String username, boolean checkDeleted) Check whether user was program member before deleting it or notbooleanisProgramOwner(long programId, String username) Check whether user can add programs or notbooleanisProgramOwner(long programId, String username, boolean checkDeleted) Check whether user was program owner before deleting it or notupdateProgram(ProgramDTO program) Update an existing ProgramupdateProgram(ProgramDTO program, org.exoplatform.services.security.Identity aclIdentity) Update an existing ProgramvoidupdateProgramDate(long programId)
-
Field Details
-
PROGRAM_UPDATED_LISTENER
- See Also:
-
PROGRAM_CREATED_LISTENER
- See Also:
-
PROGRAM_DELETED_LISTENER
- See Also:
-
PROGRAM_DISABLED_LISTENER
- See Also:
-
PROGRAM_ENABLED_LISTENER
- See Also:
-
PROGRAM_AUDIENCE_UPDATED_EVENT
- See Also:
-
-
Method Details
-
getPrograms
List<ProgramDTO> getPrograms(ProgramFilter programFilter, String username, int offset, int limit) throws IllegalAccessException Gets programs by filter.- Parameters:
programFilter-ProgramFilterused to filter resultsusername- User name accessing programsoffset- index of the searchlimit- limit of results to return- Returns:
- A
<ProgramDTO>object - Throws:
IllegalAccessException- when user is not authorized to get another owner's programs list
-
getProgramIds
List<Long> getProgramIds(ProgramFilter programFilter, String username, int offset, int limit) throws IllegalAccessException Gets Program Ids by filter.- Parameters:
programFilter-ProgramFilterused to filter resultsusername- User name accessing Programsoffset- index of the searchlimit- limit of results to return- Returns:
- A
<ProgramDTO>object - Throws:
IllegalAccessException- when user is not authorized to get another owner's Programs list
-
getProgramIds
Gets Program Ids by filter.- Parameters:
programFilter-ProgramFilterused to filter resultsoffset- index of the searchlimit- limit of results to return- Returns:
- A
<ProgramDTO>object
-
getOwnedProgramIds
- Parameters:
username- user nameoffset- start index for fetchlimit- limit to fetch- Returns:
ListofProgramDTOid of programs where the user is owner
-
getMemberProgramIds
- Parameters:
username- user nameoffset- start index for fetchlimit- limit to fetch- Returns:
ListofProgramDTOid of programs where the user is member of
-
getPublicProgramIds
- Parameters:
offset- start index for fetchlimit- limit to fetch- Returns:
ListofProgramDTOid of programs publically accessible
-
getProgramByTitle
Find a Program by title- Parameters:
programTitle- : Program title- Returns:
- found
ProgramDTO
-
createProgram
ProgramDTO createProgram(ProgramDTO program, org.exoplatform.services.security.Identity aclIdentity) throws IllegalAccessException Creates a new Program- Parameters:
program- : an object of type ProgramDTOaclIdentity- Security identity of user attempting to create a program- Returns:
- created
ProgramDTO - Throws:
IllegalAccessException- when user is not authorized to create a Program for the designated owner defined in object
-
createProgram
Creates a new Program- Parameters:
program- : an object of type ProgramDTO- Returns:
- created
ProgramDTO
-
updateProgram
ProgramDTO updateProgram(ProgramDTO program, org.exoplatform.services.security.Identity aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Update an existing Program- Parameters:
program- : an instance of type ProgramDTOaclIdentity- Security identity of user attempting to update a program- Returns:
- updated object
ProgramDTO - Throws:
IllegalArgumentException- when user is not authorized to update the Programorg.exoplatform.commons.exception.ObjectNotFoundException- when the Program identified by its technical identifier is not foundIllegalAccessException- when user is not authorized to create a Program for the designated owner defined in object
-
updateProgram
ProgramDTO updateProgram(ProgramDTO program) throws org.exoplatform.commons.exception.ObjectNotFoundException Update an existing Program- Parameters:
program- : an instance of type ProgramDTO- Returns:
- updated object
ProgramDTO - Throws:
IllegalArgumentException- when user is not authorized to update the Programorg.exoplatform.commons.exception.ObjectNotFoundException- when the Program identified by its technical identifier is not found
-
updateProgramDate
void updateProgramDate(long programId) -
deleteProgramById
ProgramDTO deleteProgramById(long programId, org.exoplatform.services.security.Identity aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Deletes an existing Program by id- Parameters:
programId- Program technical identifier to deleteaclIdentity- Security identity of user attempting to delete a program- Returns:
- deleted
ProgramDTO - Throws:
IllegalAccessException- when user is not authorized to delete programorg.exoplatform.commons.exception.ObjectNotFoundException- program not found
-
deleteProgramCoverById
void deleteProgramCoverById(long programId, org.exoplatform.services.security.Identity aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Delete program Cover identified by program id- Parameters:
programId-ProgramDTOtechnical identifieraclIdentity- Security identity of user attempting to delete the program cover- Throws:
IllegalAccessException- when user is not authorized to delete program coverorg.exoplatform.commons.exception.ObjectNotFoundException- program not found
-
deleteProgramAvatarById
void deleteProgramAvatarById(long programId, org.exoplatform.services.security.Identity aclIdentity) throws org.exoplatform.commons.exception.ObjectNotFoundException, IllegalAccessException Delete program Avatar identified by program id- Parameters:
programId-ProgramDTOtechnical identifieraclIdentity- Security identity of user attempting to delete the program avatar- Throws:
IllegalAccessException- when user is not authorized to delete program avatarorg.exoplatform.commons.exception.ObjectNotFoundException- program not found
-
getProgramById
Retrieves a program identified by its technical identifier.- Parameters:
programId- : program id- Returns:
- found
ProgramDTO
-
getProgramById
ProgramDTO getProgramById(long programId, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Retrieves a program identified by its technical identifier accessed by a user- Parameters:
programId-username-- Returns:
- found
ProgramDTO - Throws:
IllegalAccessException- when user is not authorized to access programorg.exoplatform.commons.exception.ObjectNotFoundException- program not found
-
countPrograms
Count all Programs by filter- Parameters:
programFilter-ProgramFilterused to filter Programsusername- User name accessing Programs- Returns:
- Programs count
- Throws:
IllegalAccessException- when user is not authorized to get another owner's Programs list
-
countPrograms
Count all Programs by filter- Parameters:
programFilter-ProgramFilterused to filter Programs- Returns:
- Programs count
-
countOwnedPrograms
- Parameters:
username- User name accessing Programs- Returns:
- Owned Programs count for a given user identified by its name
-
countMemberPrograms
- Parameters:
username- User name accessing Programs- Returns:
- Programs as member count for a given user identified by its name
-
countPublicPrograms
int countPublicPrograms()- Returns:
- Programs publically accessible count
-
getProgramCoverStream
InputStream getProgramCoverStream(long programId) throws org.exoplatform.commons.exception.ObjectNotFoundException Retrieves the program cover identified by Program technical identifier.- Parameters:
programId- Program unique identifier- Returns:
- found
InputStream - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- When program not found or file attachment not found
-
getProgramAvatarStream
InputStream getProgramAvatarStream(long programId) throws org.exoplatform.commons.exception.ObjectNotFoundException Retrieves the program avatar identified by Program technical identifier.- Parameters:
programId- Program unique identifier- Returns:
- found
InputStream - Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- When program not found or file attachment not found
-
canAddProgram
boolean canAddProgram(org.exoplatform.services.security.Identity aclIdentity) Check whether user can add programs or not- Parameters:
aclIdentity- Security identity of user- Returns:
- true if user has enough privileges to create a program, else false
-
canUseProgramColor
Return true if the color isn't used by any other program, else return false- Parameters:
programId-color-- Returns:
- true if not used, else false
-
isProgramOwner
Check whether user can add programs or not- Parameters:
programId- technical identifier of programusername- user name- Returns:
- true if user is a program owner, else false
-
isProgramOwner
Check whether user was program owner before deleting it or not- Parameters:
programId- technical identifier of programusername- user namecheckDeleted- Whether to consider if the program is deleted or not- Returns:
- true if user is a program owner or was a program owner before deleting the program, else false
-
isProgramMember
Check whether user is member of program or not- Parameters:
programId- technical identifier of programusername- user name- Returns:
- true if user has enough privileges to access the program, else false
-
isProgramMember
Check whether user was program member before deleting it or not- Parameters:
programId- technical identifier of programusername- user namecheckDeleted- Whether to consider if the program is deleted or not- Returns:
- true if user is a program member or was a program member before deleting the program, else false
-
canViewProgram
Check whether user can view program details or not- Parameters:
programId- technical identifier of programusername- user name- Returns:
- true if user has enough privileges to see a program, else false
-
canEditProgram
Check whether user can edit program details or not- Parameters:
programId- technical identifier of programusername- user name- Returns:
- true if user has enough privileges to edit the program, else false
-
getAdministrators
- Returns:
Listuser names, member of rewarding administrators
-