com.atlassian.crowd.dao.application
Interface ApplicationDAO

All Known Implementing Classes:
ApplicationDAOHibernate

public interface ApplicationDAO

Manages persistence of Application.


Method Summary
 Application add(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.
 List<Application> findAuthorisedApplications(long directoryId, List<String> groupNames)
          Finds all applications that are authorised for authentication given the directory id and group memberships of a user.
 Application findById(long id)
          Finds application by application id.
 Application findByName(String name)
          Finds application by application name, in a case-insensitive way.
 void 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.
 void renameGroupMappings(long directoryId, String oldGroupName, String newGroupName)
          Renames group mappings.
 List<Application> search(EntityQuery<Application> query)
          Will search for all the applications which qualify for the given EntityQuery.
 Application 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 Detail

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

Application findByName(String name)
                       throws ApplicationNotFoundException
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

Application update(Application application)
                   throws ApplicationNotFoundException
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

List<Application> search(EntityQuery<Application> query)
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)
Removes a group mapping.

Parameters:
applicationId - Application id.
directoryId - Directory id.
groupName - Group name.

removeGroupMappings

void removeGroupMappings(long directoryId,
                         String groupName)
Removes group mappings.

Parameters:
directoryId - Directory id.
groupName - Group name.

renameGroupMappings

void renameGroupMappings(long directoryId,
                         String oldGroupName,
                         String newGroupName)
Renames group mappings.

Parameters:
directoryId - Directory id.
oldGroupName - old group name.
newGroupName - new 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 are authorised for authentication given the directory id and group memberships of a user.

Parameters:
directoryId - directory id of the user.
groupNames - group memberships of the user in the particular directory.
Returns:
list of applications the user is authorised to authenticate with.

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.


Copyright © 2012 Atlassian. All Rights Reserved.