Interface ProgramService

All Known Implementing Classes:
ProgramServiceImpl

public interface ProgramService
  • Field Details

  • Method Details

    • getPrograms

      List<ProgramDTO> getPrograms(ProgramFilter programFilter, String username, int offset, int limit) throws IllegalAccessException
      Gets programs by filter.
      Parameters:
      programFilter - ProgramFilter used to filter results
      username - User name accessing programs
      offset - index of the search
      limit - 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 - ProgramFilter used to filter results
      username - User name accessing Programs
      offset - index of the search
      limit - 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, int offset, int limit)
      Gets Program Ids by filter.
      Parameters:
      programFilter - ProgramFilter used to filter results
      offset - index of the search
      limit - limit of results to return
      Returns:
      A <ProgramDTO> object
    • getOwnedProgramIds

      List<Long> getOwnedProgramIds(String username, int offset, int limit)
      Parameters:
      username - user name
      offset - start index for fetch
      limit - limit to fetch
      Returns:
      List of ProgramDTO id of programs where the user is owner
    • getMemberProgramIds

      List<Long> getMemberProgramIds(String username, int offset, int limit)
      Parameters:
      username - user name
      offset - start index for fetch
      limit - limit to fetch
      Returns:
      List of ProgramDTO id of programs where the user is member of
    • getPublicProgramIds

      List<Long> getPublicProgramIds(int offset, int limit)
      Parameters:
      offset - start index for fetch
      limit - limit to fetch
      Returns:
      List of ProgramDTO id of programs publically accessible
    • getProgramByTitle

      ProgramDTO getProgramByTitle(String programTitle)
      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 ProgramDTO
      aclIdentity - 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

      ProgramDTO createProgram(ProgramDTO program)
      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 ProgramDTO
      aclIdentity - Security identity of user attempting to update a program
      Returns:
      updated object ProgramDTO
      Throws:
      IllegalArgumentException - when user is not authorized to update the Program
      org.exoplatform.commons.exception.ObjectNotFoundException - when the Program identified by its technical identifier is not found
      IllegalAccessException - 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 Program
      org.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 delete
      aclIdentity - Security identity of user attempting to delete a program
      Returns:
      deleted ProgramDTO
      Throws:
      IllegalAccessException - when user is not authorized to delete program
      org.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 - ProgramDTO technical identifier
      aclIdentity - Security identity of user attempting to delete the program cover
      Throws:
      IllegalAccessException - when user is not authorized to delete program cover
      org.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 - ProgramDTO technical identifier
      aclIdentity - Security identity of user attempting to delete the program avatar
      Throws:
      IllegalAccessException - when user is not authorized to delete program avatar
      org.exoplatform.commons.exception.ObjectNotFoundException - program not found
    • getProgramById

      ProgramDTO getProgramById(long programId)
      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 program
      org.exoplatform.commons.exception.ObjectNotFoundException - program not found
    • countPrograms

      int countPrograms(ProgramFilter programFilter, String username) throws IllegalAccessException
      Count all Programs by filter
      Parameters:
      programFilter - ProgramFilter used to filter Programs
      username - User name accessing Programs
      Returns:
      Programs count
      Throws:
      IllegalAccessException - when user is not authorized to get another owner's Programs list
    • countPrograms

      int countPrograms(ProgramFilter programFilter)
      Count all Programs by filter
      Parameters:
      programFilter - ProgramFilter used to filter Programs
      Returns:
      Programs count
    • countOwnedPrograms

      int countOwnedPrograms(String username)
      Parameters:
      username - User name accessing Programs
      Returns:
      Owned Programs count for a given user identified by its name
    • countMemberPrograms

      int countMemberPrograms(String username)
      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

      boolean canUseProgramColor(long programId, String color)
      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

      boolean isProgramOwner(long programId, String username)
      Check whether user can add programs or not
      Parameters:
      programId - technical identifier of program
      username - user name
      Returns:
      true if user is a program owner, else false
    • isProgramOwner

      boolean isProgramOwner(long programId, String username, boolean checkDeleted)
      Check whether user was program owner before deleting it or not
      Parameters:
      programId - technical identifier of program
      username - user name
      checkDeleted - 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

      boolean isProgramMember(long programId, String username)
      Check whether user is member of program or not
      Parameters:
      programId - technical identifier of program
      username - user name
      Returns:
      true if user has enough privileges to access the program, else false
    • isProgramMember

      boolean isProgramMember(long programId, String username, boolean checkDeleted)
      Check whether user was program member before deleting it or not
      Parameters:
      programId - technical identifier of program
      username - user name
      checkDeleted - 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

      boolean canViewProgram(long programId, String username)
      Check whether user can view program details or not
      Parameters:
      programId - technical identifier of program
      username - user name
      Returns:
      true if user has enough privileges to see a program, else false
    • canEditProgram

      boolean canEditProgram(long programId, String username)
      Check whether user can edit program details or not
      Parameters:
      programId - technical identifier of program
      username - user name
      Returns:
      true if user has enough privileges to edit the program, else false
    • getAdministrators

      List<String> getAdministrators()
      Returns:
      List user names, member of rewarding administrators