Interface ApplicationDAO

All Known Implementing Classes:
ApplicationDAOHibernate

public interface ApplicationDAO
Manages persistence of Application.
  • Method Details

    • findById

      Application findById(long id) throws ApplicationNotFoundException
      Finds application by application id.
      Parameters:
      id - Application id.
      Returns:
      Application.
      Throws:
      ApplicationNotFoundException - If application of the specified id does not exist.
    • findByName

      Finds application by application name, in a case-insensitive way.
      Parameters:
      name - Application name.
      Returns:
      Application.
      Throws:
      ApplicationNotFoundException - If application of the specified name does not exist.
    • add

      Application add(Application application, PasswordCredential passwordCredential)
      Will only create the core attributes to an application, i.e. this will not create directory mappings (thus group mappings).
      Parameters:
      application - The application.
      passwordCredential - Credential.
      Returns:
      The added application.
    • update

      Will only update the core attributes to an application, i.e. this will not update directory mappings (thus group mappings). remote address' or permissions.
      Parameters:
      application - The application.
      Returns:
      The added application.
      Throws:
      ApplicationNotFoundException - If the application could not be found.
    • updateCredential

      void updateCredential(Application application, PasswordCredential passwordCredential) throws ApplicationNotFoundException
      Updates credential of the given application.
      Parameters:
      application - The application.
      passwordCredential - The new credential.
      Throws:
      ApplicationNotFoundException - If the application could not be found.
    • remove

      void remove(Application application)
      Removes the application. All its aliases will also be removed.
      Parameters:
      application - The application.
    • search

      Will search for all the applications which qualify for the given EntityQuery.
      Parameters:
      query - Entity query of type EntityDescriptor.application().
      Returns:
      A list of applications (could be empty).
    • addDirectoryMapping

      void addDirectoryMapping(long applicationId, long directoryId, boolean allowAllToAuthenticate, OperationType... operationTypes) throws DirectoryNotFoundException, ApplicationNotFoundException
      Adds a mapping between application and directory. Both are identified by ids.
      Parameters:
      applicationId - Application id.
      directoryId - Directory id.
      allowAllToAuthenticate - True if all users in the directory are allowed to authenticate against the application.
      operationTypes - The collection of permissible operation types.
      Throws:
      DirectoryNotFoundException - if the directory specified by the directoryId does not exist.
      ApplicationNotFoundException - if the application specified by the applicationId does not exist.
    • addRemoteAddress

      void addRemoteAddress(long applicationId, RemoteAddress remoteAddress) throws ApplicationNotFoundException
      Associates a remote address to the given application.
      Parameters:
      applicationId - Application id.
      remoteAddress - Remote address.
      Throws:
      ApplicationNotFoundException - If the application cannot be found.
    • removeRemoteAddress

      void removeRemoteAddress(long applicationId, RemoteAddress remoteAddress) throws ApplicationNotFoundException
      Dissociates the given remote address from the given application.
      Parameters:
      applicationId - Application id.
      remoteAddress - Remote address, not null.
      Throws:
      ApplicationNotFoundException - If the application cannot be found.
    • removeDirectoryMapping

      void removeDirectoryMapping(long applicationId, long directoryId) throws ApplicationNotFoundException
      Removes a mapping between application and directory. Both are identified by ids.
      Parameters:
      applicationId - Application id.
      directoryId - Directory id.
      Throws:
      ApplicationNotFoundException - If the application cannot be found.
    • removeDirectoryMappings

      void removeDirectoryMappings(long directoryId)
      Removes all the mappings associated with the given directory identified by directory id.
      Parameters:
      directoryId - Directory id.
    • addGroupMapping

      void addGroupMapping(long applicationId, long directoryId, String groupName) throws ApplicationNotFoundException
      Adds a group mapping.
      Parameters:
      applicationId - Application id.
      directoryId - Directory id.
      groupName - Group name.
      Throws:
      ApplicationNotFoundException - If the application cannot be found.
    • removeGroupMapping

      void removeGroupMapping(long applicationId, long directoryId, String groupName) throws ApplicationNotFoundException
      Removes a group mapping.
      Parameters:
      applicationId - Application id.
      directoryId - Directory id.
      groupName - Group name.
      Throws:
      ApplicationNotFoundException
    • removeGroupMappings

      void removeGroupMappings(long directoryId, String groupName)
      Removes group mappings.
      Parameters:
      directoryId - Directory id.
      groupName - Group name.
    • updateDirectoryMapping

      void updateDirectoryMapping(long applicationId, long directoryId, int position) throws ApplicationNotFoundException, DirectoryNotFoundException
      Updates the ordering of directory mappings for an application. This method only has the effect of changing the order of the mapped directories.
      Parameters:
      applicationId - Application id
      directoryId - Directory id
      position - New position in the order of directories for this given directory. Positions in the list of directories are absolute and zero based.
      Throws:
      ApplicationNotFoundException - if the application could not be found
      DirectoryNotFoundException - if the directory could not be found
    • findAuthorisedApplications

      List<Application> findAuthorisedApplications(long directoryId, List<String> groupNames)
      Finds all applications that a user from a given directory belonging to the specified groups can authenticate to.
      Parameters:
      directoryId - directory id of the user.
      groupNames - group memberships of the user in the particular directory.
      Returns:
      list of applications the user can authenticate to.
    • updateDirectoryMapping

      void updateDirectoryMapping(long applicationId, long directoryId, boolean allowAllToAuthenticate) throws ApplicationNotFoundException, DirectoryNotFoundException
      Updates a directory mapping.
      Parameters:
      applicationId - Application id
      directoryId - Directory id.
      allowAllToAuthenticate - True, if all users are allowed to authenticate.
      Throws:
      ApplicationNotFoundException - If the application cannot be found.
      DirectoryNotFoundException - If the directory cannot be found.
    • updateDirectoryMapping

      void updateDirectoryMapping(long applicationId, long directoryId, boolean allowAllToAuthenticate, Set<OperationType> operationTypes) throws ApplicationNotFoundException, DirectoryNotFoundException
      Updates a directory mapping.
      Parameters:
      applicationId - Application id
      directoryId - Directory id.
      allowAllToAuthenticate - True, if all users are allowed to authenticate.
      operationTypes - the set of permissible operation types.
      Throws:
      ApplicationNotFoundException - If the application cannot be found.
      DirectoryNotFoundException - If the directory cannot be found.
    • findDirectoryMapping

      DirectoryMapping findDirectoryMapping(long applicationId, long directoryId) throws ApplicationNotFoundException, DirectoryMappingNotFoundException
      Finds the directory mapping for a given application and directory combination
      Parameters:
      applicationId - Application id
      directoryId - Directory id
      Returns:
      the mapping for the given application and directory combination
      Throws:
      ApplicationNotFoundException - If the application cannot be found
      DirectoryMappingNotFoundException - If the directory mapping cannot be found