Interface ApplicationManager
- All Known Implementing Classes:
ApplicationManagerGeneric
public interface ApplicationManager
Application management API.
-
Method Summary
Modifier and TypeMethodDescriptionadd
(Application application) Will add the given Application to Crowdvoid
addDirectoryMapping
(Application application, Directory directory, boolean allowAllToAuthenticate, OperationType... operationTypes) Will add a DirectoryMapping between the passed in Application and Directory.void
addGroupMapping
(Application application, Directory directory, String groupName) Will add a group mapping for the given application + directory mapping.void
addRemoteAddress
(Application application, RemoteAddress remoteAddress) Will add a remote address to the current applicationboolean
authenticate
(Application application, PasswordCredential testCredential) Takes an application, which contains a hashed credential, and compares that to a hash of the supplied testCredential.findAll()
Retrieves all the applications in the Crowd system.findById
(long id) Find an application by its ID.findByName
(String name) Find an application by its name.void
remove
(Application application) Remove an application.void
removeDirectoryFromApplication
(Directory directory, Application application) Will remove a directory from an application.void
removeGroupMapping
(Application application, Directory directory, String groupName) Will remove a group mapping for the given application + directory mapping.void
removeRemoteAddress
(Application application, RemoteAddress remoteAddress) Will remove the passed in RemoteAddress from the applicationsearch
(EntityQuery query) Search applications.update
(Application application) Updates an application's details.void
updateCredential
(Application application, PasswordCredential passwordCredential) Takes an application with a List of credentials that are unencrypted, encrypts them and then updates the application in the database with the encrypted credentialsvoid
updateDirectoryMapping
(Application application, Directory directory, boolean allowAllToAuthenticate) Will update the Directory Mapping, setting to enable/disable allowing all users to authenticate for the given mapping (not taking group membership into consideration)void
updateDirectoryMapping
(Application application, Directory directory, boolean allowAllToAuthenticate, Set<OperationType> operationTypes) Will update a directory mapping against the Application moving it to the selected position in the list of DirectoryMappings.void
updateDirectoryMapping
(Application application, Directory directory, int position) Will update a directory mapping against the Application moving it to the selected position in the list of DirectoryMappings.
-
Method Details
-
add
Application add(Application application) throws InvalidCredentialException, ApplicationAlreadyExistsException Will add the given Application to Crowd- Parameters:
application
- the Application to add.- Returns:
- the added Application
- Throws:
InvalidCredentialException
- if there was an error encrypting the Applications passwordApplicationAlreadyExistsException
- if an application with the same name already exists
-
findById
Find an application by its ID.- Parameters:
id
- database ID.- Returns:
- application object.
- Throws:
ApplicationNotFoundException
- application with requested ID does not exist.
-
findByName
Find an application by its name.- Parameters:
name
- name of application.- Returns:
- application object.
- Throws:
ApplicationNotFoundException
- application with requested name does not exist.
-
remove
Remove an application.- Parameters:
application
- application to remove.- Throws:
ApplicationManagerException
- if the remove operation is not permitted on the given application.
-
removeDirectoryFromApplication
void removeDirectoryFromApplication(Directory directory, Application application) throws ApplicationManagerException Will remove a directory from an application. This will also remove all other mapped objects.- Parameters:
directory
- the directory you wish to disociateapplication
- the application you wish to apply this dissociation too- Throws:
ApplicationManagerException
- thrown if anything goes bad, updating the application
-
addDirectoryMapping
void addDirectoryMapping(Application application, Directory directory, boolean allowAllToAuthenticate, OperationType... operationTypes) throws ApplicationNotFoundException, DirectoryNotFoundException Will add a DirectoryMapping between the passed in Application and Directory. This mapping will be added to the end of the current list of mappings. If a directory mapping already exists for this association this call will simply operate as an update for the given mapping.- Parameters:
application
- the application in questiondirectory
- the directory associated to the applicationallowAllToAuthenticate
- to enable/disable the allow all to authenticate flagoperationTypes
- The set of allowed operations for the given directory/application mapping- Throws:
ApplicationNotFoundException
- if the application could not be foundDirectoryNotFoundException
- if the directory could not be found
-
updateDirectoryMapping
void updateDirectoryMapping(Application application, Directory directory, int position) throws ApplicationNotFoundException, DirectoryNotFoundException Will update a directory mapping against the Application moving it to the selected position in the list of DirectoryMappings.- Parameters:
application
- the application in questiondirectory
- the directory associated to the applicationposition
- This will recognise the need to shift a mapping either up or down in the. A -ve value will not result in an index shift- Throws:
ApplicationNotFoundException
- if the application could not be foundDirectoryNotFoundException
- if the directory could not be found
-
updateDirectoryMapping
void updateDirectoryMapping(Application application, Directory directory, boolean allowAllToAuthenticate) throws ApplicationNotFoundException, DirectoryNotFoundException Will update the Directory Mapping, setting to enable/disable allowing all users to authenticate for the given mapping (not taking group membership into consideration)- Parameters:
application
- the application in questiondirectory
- the directory associated to the applicationallowAllToAuthenticate
- to enable/disable the allow all to authenticate flag- Throws:
ApplicationNotFoundException
- if the application could not be foundDirectoryNotFoundException
- if the directory could not be found
-
updateDirectoryMapping
void updateDirectoryMapping(Application application, Directory directory, boolean allowAllToAuthenticate, Set<OperationType> operationTypes) throws ApplicationNotFoundException, DirectoryNotFoundException Will update a directory mapping against the Application moving it to the selected position in the list of DirectoryMappings.- Parameters:
application
- the application in questiondirectory
- the directory associated to the applicationallowAllToAuthenticate
- to enable/disable the allow all to authenticate flagoperationTypes
- The set of allowed operations for the given directory/application mapping- Throws:
ApplicationNotFoundException
- if the application could not be foundDirectoryNotFoundException
- if the directory could not be found
-
addRemoteAddress
void addRemoteAddress(Application application, RemoteAddress remoteAddress) throws ApplicationNotFoundException Will add a remote address to the current application- Parameters:
application
- the application to updateremoteAddress
- the remote address to add- Throws:
ApplicationNotFoundException
- if the application could not be found
-
removeRemoteAddress
void removeRemoteAddress(Application application, RemoteAddress remoteAddress) throws ApplicationNotFoundException Will remove the passed in RemoteAddress from the application- Parameters:
application
- the application to updateremoteAddress
- the remote address to remove- Throws:
ApplicationNotFoundException
- if the application could not be found
-
addGroupMapping
void addGroupMapping(Application application, Directory directory, String groupName) throws ApplicationNotFoundException Will add a group mapping for the given application + directory mapping.- Parameters:
application
- the application to updatedirectory
- the directory associated to the applicationgroupName
- the group name to add- Throws:
ApplicationNotFoundException
- if the application could not be found
-
removeGroupMapping
void removeGroupMapping(Application application, Directory directory, String groupName) throws ApplicationNotFoundException Will remove a group mapping for the given application + directory mapping.- Parameters:
application
- the application to updatedirectory
- the directory associated to the applicationgroupName
- the group name to remove- Throws:
ApplicationNotFoundException
-
update
Application update(Application application) throws ApplicationManagerException, ApplicationNotFoundException Updates an application's details.- Parameters:
application
- modified application.- Returns:
- modified application.
- Throws:
ApplicationManagerException
- error updating application, ie. if you try to rename a permanent application or try to deactivate the CROWD application.ApplicationNotFoundException
- if the application could not be found
-
updateCredential
void updateCredential(Application application, PasswordCredential passwordCredential) throws ApplicationManagerException, ApplicationNotFoundException Takes an application with a List of credentials that are unencrypted, encrypts them and then updates the application in the database with the encrypted credentials- Parameters:
application
- an application with unencrypted password credentialspasswordCredential
- unencrypted password.- Throws:
ApplicationManagerException
- not allowed to update.ApplicationNotFoundException
- if the application could not be found
-
authenticate
boolean authenticate(Application application, PasswordCredential testCredential) throws ApplicationNotFoundException Takes an application, which contains a hashed credential, and compares that to a hash of the supplied testCredential.- Parameters:
application
- application to authenticate as.testCredential
- credentials to authenticate with.- Returns:
true
iff the testCredential matches the actual application credential.- Throws:
ApplicationNotFoundException
- if the application could not be found
-
search
Search applications.- Parameters:
query
- Application entity query.- Returns:
- list of Applications.
-
findAll
List<Application> findAll()Retrieves all the applications in the Crowd system.- Returns:
- List of all Applications.
-