com.atlassian.crowd.manager.application
Class ApplicationManagerGeneric

java.lang.Object
  extended by com.atlassian.crowd.manager.application.ApplicationManagerGeneric
All Implemented Interfaces:
ApplicationManager

public class ApplicationManagerGeneric
extends Object
implements ApplicationManager


Constructor Summary
ApplicationManagerGeneric(ApplicationDAO applicationDao, PasswordEncoderFactory passwordEncoderFactory, com.atlassian.event.api.EventPublisher eventPublisher)
           
 
Method Summary
 Application add(Application application)
          Will add the given Application to Crowd
 void 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 application
 boolean authenticate(Application application, PasswordCredential testCredential)
          Takes an application, which contains a hashed credential, and compares that to a hash of the supplied testCredential.
 List<Application> findAll()
          Retrieves all the applications in the Crowd system.
 Application findById(long id)
          Find an application by its ID.
 Application 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 application
 List<Application> search(EntityQuery query)
          Search applications.
 Application 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 credentials
 void 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationManagerGeneric

public ApplicationManagerGeneric(ApplicationDAO applicationDao,
                                 PasswordEncoderFactory passwordEncoderFactory,
                                 com.atlassian.event.api.EventPublisher eventPublisher)
Method Detail

add

public Application add(Application application)
                throws InvalidCredentialException
Description copied from interface: ApplicationManager
Will add the given Application to Crowd

Specified by:
add in interface ApplicationManager
Parameters:
application - the Application to add.
Returns:
the added Application
Throws:
InvalidCredentialException - if there was an error encrypting the Applications password

findById

public Application findById(long id)
                     throws ApplicationNotFoundException
Description copied from interface: ApplicationManager
Find an application by its ID.

Specified by:
findById in interface ApplicationManager
Parameters:
id - database ID.
Returns:
application object.
Throws:
ApplicationNotFoundException - application with requested ID does not exist.

findByName

public Application findByName(String name)
                       throws ApplicationNotFoundException
Description copied from interface: ApplicationManager
Find an application by its name.

Specified by:
findByName in interface ApplicationManager
Parameters:
name - name of application.
Returns:
application object.
Throws:
ApplicationNotFoundException - application with requested name does not exist.

remove

public void remove(Application application)
            throws ApplicationManagerException
Description copied from interface: ApplicationManager
Remove an application.

Specified by:
remove in interface ApplicationManager
Parameters:
application - application to remove.
Throws:
ApplicationManagerException - if the remove operation is not permitted on the given application.

removeDirectoryFromApplication

public void removeDirectoryFromApplication(Directory directory,
                                           Application application)
                                    throws ApplicationManagerException
Description copied from interface: ApplicationManager
Will remove a directory from an application. This will also remove all other mapped objects.

Specified by:
removeDirectoryFromApplication in interface ApplicationManager
Parameters:
directory - the directory you wish to disociate
application - the application you wish to apply this dissociation too
Throws:
ApplicationManagerException - thrown if anything goes bad, updating the application

search

public List<Application> search(EntityQuery query)
Description copied from interface: ApplicationManager
Search applications.

Specified by:
search in interface ApplicationManager
Parameters:
query - Application entity query.
Returns:
list of Applications.

findAll

public List<Application> findAll()
Description copied from interface: ApplicationManager
Retrieves all the applications in the Crowd system.

Specified by:
findAll in interface ApplicationManager
Returns:
List of all Applications.

update

public Application update(Application application)
                   throws ApplicationManagerException,
                          ApplicationNotFoundException
Description copied from interface: ApplicationManager
Updates an application's details.

Specified by:
update in interface ApplicationManager
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

public void updateCredential(Application application,
                             PasswordCredential passwordCredential)
                      throws ApplicationManagerException,
                             ApplicationNotFoundException
Description copied from interface: ApplicationManager
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

Specified by:
updateCredential in interface ApplicationManager
Parameters:
application - an application with unencrypted password credentials
passwordCredential - unencrypted password.
Throws:
ApplicationManagerException - not allowed to update.
ApplicationNotFoundException - if the application could not be found

authenticate

public boolean authenticate(Application application,
                            PasswordCredential testCredential)
                     throws ApplicationNotFoundException
Description copied from interface: ApplicationManager
Takes an application, which contains a hashed credential, and compares that to a hash of the supplied testCredential.

Specified by:
authenticate in interface ApplicationManager
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

addDirectoryMapping

public void addDirectoryMapping(Application application,
                                Directory directory,
                                boolean allowAllToAuthenticate,
                                OperationType... operationTypes)
                         throws ApplicationNotFoundException,
                                DirectoryNotFoundException
Description copied from interface: ApplicationManager
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.

Specified by:
addDirectoryMapping in interface ApplicationManager
Parameters:
application - the application in question
directory - the directory associated to the application
allowAllToAuthenticate - to enable/disable the allow all to authenticate flag
operationTypes - The set of allowed operations for the given directory/application mapping
Throws:
ApplicationNotFoundException - if the application could not be found
DirectoryNotFoundException - if the directory could not be found

updateDirectoryMapping

public void updateDirectoryMapping(Application application,
                                   Directory directory,
                                   int position)
                            throws ApplicationNotFoundException,
                                   DirectoryNotFoundException
Description copied from interface: ApplicationManager
Will update a directory mapping against the Application moving it to the selected position in the list of DirectoryMappings.

Specified by:
updateDirectoryMapping in interface ApplicationManager
Parameters:
application - the application in question
directory - the directory associated to the application
position - 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 found
DirectoryNotFoundException - if the directory could not be found

updateDirectoryMapping

public void updateDirectoryMapping(Application application,
                                   Directory directory,
                                   boolean allowAllToAuthenticate)
                            throws ApplicationNotFoundException,
                                   DirectoryNotFoundException
Description copied from interface: ApplicationManager
Will update the Directory Mapping, setting to enable/disable allowing all users to authenticate for the given mapping (not taking group membership into consideration)

Specified by:
updateDirectoryMapping in interface ApplicationManager
Parameters:
application - the application in question
directory - the directory associated to the application
allowAllToAuthenticate - to enable/disable the allow all to authenticate flag
Throws:
ApplicationNotFoundException - if the application could not be found
DirectoryNotFoundException - if the directory could not be found

updateDirectoryMapping

public void updateDirectoryMapping(Application application,
                                   Directory directory,
                                   boolean allowAllToAuthenticate,
                                   Set<OperationType> operationTypes)
                            throws ApplicationNotFoundException,
                                   DirectoryNotFoundException
Description copied from interface: ApplicationManager
Will update a directory mapping against the Application moving it to the selected position in the list of DirectoryMappings.

Specified by:
updateDirectoryMapping in interface ApplicationManager
Parameters:
application - the application in question
directory - the directory associated to the application
allowAllToAuthenticate - to enable/disable the allow all to authenticate flag
operationTypes - The set of allowed operations for the given directory/application mapping
Throws:
ApplicationNotFoundException - if the application could not be found
DirectoryNotFoundException - if the directory could not be found

addRemoteAddress

public void addRemoteAddress(Application application,
                             RemoteAddress remoteAddress)
                      throws ApplicationNotFoundException
Description copied from interface: ApplicationManager
Will add a remote address to the current application

Specified by:
addRemoteAddress in interface ApplicationManager
Parameters:
application - the application to update
remoteAddress - the remote address to add
Throws:
ApplicationNotFoundException - if the application could not be found

removeRemoteAddress

public void removeRemoteAddress(Application application,
                                RemoteAddress remoteAddress)
                         throws ApplicationNotFoundException
Description copied from interface: ApplicationManager
Will remove the passed in RemoteAddress from the application

Specified by:
removeRemoteAddress in interface ApplicationManager
Parameters:
application - the application to update
remoteAddress - the remote address to remove
Throws:
ApplicationNotFoundException - if the application could not be found

addGroupMapping

public void addGroupMapping(Application application,
                            Directory directory,
                            String groupName)
                     throws ApplicationNotFoundException
Description copied from interface: ApplicationManager
Will add a group mapping for the given application + directory mapping.

Specified by:
addGroupMapping in interface ApplicationManager
Parameters:
application - the application to update
directory - the directory associated to the application
groupName - the group name to add
Throws:
ApplicationNotFoundException - if the application could not be found

removeGroupMapping

public void removeGroupMapping(Application application,
                               Directory directory,
                               String groupName)
                        throws ApplicationNotFoundException
Description copied from interface: ApplicationManager
Will remove a group mapping for the given application + directory mapping.

Specified by:
removeGroupMapping in interface ApplicationManager
Parameters:
application - the application to update
directory - the directory associated to the application
groupName - the group name to remove
Throws:
ApplicationNotFoundException


Copyright © 2013 Atlassian. All Rights Reserved.