Interface ApplicationDAO
- All Known Implementing Classes:
ApplicationDAOHibernate
public interface ApplicationDAO
Manages persistence of
Application
.-
Method Summary
Modifier and TypeMethodDescriptionadd
(Application application, PasswordCredential passwordCredential) Will only create the core attributes to an application, i.e.void
addDirectoryMapping
(long applicationId, long directoryId, boolean allowAllToAuthenticate, OperationType... operationTypes) Adds a mapping between application and directory.void
addGroupMapping
(long applicationId, long directoryId, String groupName) Adds a group mapping.void
addRemoteAddress
(long applicationId, RemoteAddress remoteAddress) Associates a remote address to the given 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.findById
(long id) Finds application by application id.findByName
(String name) Finds application by application name, in a case-insensitive way.findDirectoryMapping
(long applicationId, long directoryId) Finds the directory mapping for a given application and directory combinationvoid
remove
(Application application) Removes the application.void
removeDirectoryMapping
(long applicationId, long directoryId) Removes a mapping between application and directory.void
removeDirectoryMappings
(long directoryId) Removes all the mappings associated with the given directory identified by directory id.void
removeGroupMapping
(long applicationId, long directoryId, String groupName) Removes a group mapping.void
removeGroupMappings
(long directoryId, String groupName) Removes group mappings.void
removeRemoteAddress
(long applicationId, RemoteAddress remoteAddress) Dissociates the given remote address from the given application.search
(EntityQuery<Application> query) Will search for all the applications which qualify for the givenEntityQuery
.update
(Application application) Will only update the core attributes to an application, i.e.void
updateCredential
(Application application, PasswordCredential passwordCredential) Updates credential of the given application.void
updateDirectoryMapping
(long applicationId, long directoryId, boolean allowAllToAuthenticate) Updates a directory mapping.void
updateDirectoryMapping
(long applicationId, long directoryId, boolean allowAllToAuthenticate, Set<OperationType> operationTypes) Updates a directory mapping.void
updateDirectoryMapping
(long applicationId, long directoryId, int position) Updates the ordering of directory mappings for an application.
-
Method Details
-
findById
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
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
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 givenEntityQuery
.- Parameters:
query
- Entity query of typeEntityDescriptor.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
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 iddirectoryId
- Directory idposition
- 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 foundDirectoryNotFoundException
- if the directory could not be found
-
findAuthorisedApplications
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 iddirectoryId
- 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 iddirectoryId
- 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 iddirectoryId
- Directory id- Returns:
- the mapping for the given application and directory combination
- Throws:
ApplicationNotFoundException
- If the application cannot be foundDirectoryMappingNotFoundException
- If the directory mapping cannot be found
-