com.atlassian.crowd.dao.application
Class ApplicationDAOHibernate

java.lang.Object
  extended by com.atlassian.crowd.util.persistence.hibernate.HibernateDao
      extended by com.atlassian.crowd.dao.application.ApplicationDAOHibernate
All Implemented Interfaces:
ApplicationDAO

public class ApplicationDAOHibernate
extends HibernateDao
implements ApplicationDAO


Field Summary
 
Fields inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao
batchFinder, batchProcessor, logger, sessionFactory
 
Constructor Summary
ApplicationDAOHibernate()
           
 
Method Summary
 ApplicationImpl 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.
 ApplicationImpl findById(long id)
          Finds application by application id.
 ApplicationImpl findByName(String name)
          Finds application by application name, in a case-insensitive way.
 Class getPersistentClass()
          All subclasses of HibernateDao must implement this method for HibernateDao.load(long) to work correctly.
 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.
 void setAliasDao(AliasDAO aliasDao)
           
 void setDirectoryDao(DirectoryDao directoryDao)
           
 void setHqlQueryTranslater(HQLQueryTranslater hqlQueryTranslater)
           
 ApplicationImpl 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.
 
Methods inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao
createHibernateQuery, load, load, loadReference, loadReference, remove, save, saveOrUpdate, session, setBatchFinder, setBatchProcessor, setSessionFactory, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApplicationDAOHibernate

public ApplicationDAOHibernate()
Method Detail

add

public ApplicationImpl add(Application application,
                           PasswordCredential passwordCredential)
Description copied from interface: ApplicationDAO
Will only create the core attributes to an application, i.e. this will not create directory mappings (thus group mappings).

Specified by:
add in interface ApplicationDAO
Parameters:
application - The application.
passwordCredential - Credential.
Returns:
The added application.

addDirectoryMapping

public void addDirectoryMapping(long applicationId,
                                long directoryId,
                                boolean allowAllToAuthenticate,
                                OperationType... operationTypes)
                         throws DirectoryNotFoundException,
                                ApplicationNotFoundException
Description copied from interface: ApplicationDAO
Adds a mapping between application and directory. Both are identified by ids.

Specified by:
addDirectoryMapping in interface ApplicationDAO
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.

addGroupMapping

public void addGroupMapping(long applicationId,
                            long directoryId,
                            String groupName)
                     throws ApplicationNotFoundException
Description copied from interface: ApplicationDAO
Adds a group mapping.

Specified by:
addGroupMapping in interface ApplicationDAO
Parameters:
applicationId - Application id.
directoryId - Directory id.
groupName - Group name.
Throws:
ApplicationNotFoundException - If the application cannot be found.

addRemoteAddress

public void addRemoteAddress(long applicationId,
                             RemoteAddress remoteAddress)
                      throws ApplicationNotFoundException
Description copied from interface: ApplicationDAO
Associates a remote address to the given application.

Specified by:
addRemoteAddress in interface ApplicationDAO
Parameters:
applicationId - Application id.
remoteAddress - Remote address.
Throws:
ApplicationNotFoundException - If the application cannot be found.

findAuthorisedApplications

public List<Application> findAuthorisedApplications(long directoryId,
                                                    List<String> groupNames)
Description copied from interface: ApplicationDAO
Finds all applications that are authorised for authentication given the directory id and group memberships of a user.

Specified by:
findAuthorisedApplications in interface ApplicationDAO
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.

findById

public ApplicationImpl findById(long id)
                         throws ApplicationNotFoundException
Description copied from interface: ApplicationDAO
Finds application by application id.

Specified by:
findById in interface ApplicationDAO
Parameters:
id - Application id.
Returns:
Application.
Throws:
ApplicationNotFoundException - If application of the specified id does not exist.

findByName

public ApplicationImpl findByName(String name)
                           throws ApplicationNotFoundException
Description copied from interface: ApplicationDAO
Finds application by application name, in a case-insensitive way.

Specified by:
findByName in interface ApplicationDAO
Parameters:
name - Application name.
Returns:
Application.
Throws:
ApplicationNotFoundException - If application of the specified name does not exist.

getPersistentClass

public Class getPersistentClass()
Description copied from class: HibernateDao
All subclasses of HibernateDao must implement this method for HibernateDao.load(long) to work correctly.

Specified by:
getPersistentClass in class HibernateDao
Returns:
the entity class for this DAO

remove

public void remove(Application application)
Description copied from interface: ApplicationDAO
Removes the application. All its aliases will also be removed.

Specified by:
remove in interface ApplicationDAO
Parameters:
application - The application.

removeDirectoryMapping

public void removeDirectoryMapping(long applicationId,
                                   long directoryId)
                            throws ApplicationNotFoundException
Description copied from interface: ApplicationDAO
Removes a mapping between application and directory. Both are identified by ids.

Specified by:
removeDirectoryMapping in interface ApplicationDAO
Parameters:
applicationId - Application id.
directoryId - Directory id.
Throws:
ApplicationNotFoundException - If the application cannot be found.

removeDirectoryMappings

public void removeDirectoryMappings(long directoryId)
Description copied from interface: ApplicationDAO
Removes all the mappings associated with the given directory identified by directory id.

Specified by:
removeDirectoryMappings in interface ApplicationDAO
Parameters:
directoryId - Directory id.

removeGroupMapping

public void removeGroupMapping(long applicationId,
                               long directoryId,
                               String groupName)
                        throws ApplicationNotFoundException
Description copied from interface: ApplicationDAO
Removes a group mapping.

Specified by:
removeGroupMapping in interface ApplicationDAO
Parameters:
applicationId - Application id.
directoryId - Directory id.
groupName - Group name.
Throws:
ApplicationNotFoundException

removeGroupMappings

public void removeGroupMappings(long directoryId,
                                String groupName)
Description copied from interface: ApplicationDAO
Removes group mappings.

Specified by:
removeGroupMappings in interface ApplicationDAO
Parameters:
directoryId - Directory id.
groupName - Group name.

removeRemoteAddress

public void removeRemoteAddress(long applicationId,
                                RemoteAddress remoteAddress)
                         throws ApplicationNotFoundException
Description copied from interface: ApplicationDAO
Dissociates the given remote address from the given application.

Specified by:
removeRemoteAddress in interface ApplicationDAO
Parameters:
applicationId - Application id.
remoteAddress - Remote address, not null.
Throws:
ApplicationNotFoundException - If the application cannot be found.

renameGroupMappings

public void renameGroupMappings(long directoryId,
                                String oldGroupName,
                                String newGroupName)
Description copied from interface: ApplicationDAO
Renames group mappings.

Specified by:
renameGroupMappings in interface ApplicationDAO
Parameters:
directoryId - Directory id.
oldGroupName - old group name.
newGroupName - new group name.

search

public List<Application> search(EntityQuery<Application> query)
Description copied from interface: ApplicationDAO
Will search for all the applications which qualify for the given EntityQuery.

Specified by:
search in interface ApplicationDAO
Parameters:
query - Entity query of type EntityDescriptor.application().
Returns:
A list of applications (could be empty).

update

public ApplicationImpl update(Application application)
                       throws ApplicationNotFoundException
Description copied from interface: ApplicationDAO
Will only update the core attributes to an application, i.e. this will not update directory mappings (thus group mappings). remote address' or permissions.

Specified by:
update in interface ApplicationDAO
Parameters:
application - The application.
Returns:
The added application.
Throws:
ApplicationNotFoundException - If the application could not be found.

updateCredential

public void updateCredential(Application application,
                             PasswordCredential passwordCredential)
                      throws ApplicationNotFoundException
Description copied from interface: ApplicationDAO
Updates credential of the given application.

Specified by:
updateCredential in interface ApplicationDAO
Parameters:
application - The application.
passwordCredential - The new credential.
Throws:
ApplicationNotFoundException - If the application could not be found.

updateDirectoryMapping

public void updateDirectoryMapping(long applicationId,
                                   long directoryId,
                                   int position)
                            throws ApplicationNotFoundException,
                                   DirectoryNotFoundException
Description copied from interface: ApplicationDAO
Updates the ordering of directory mappings for an application. This method only has the effect of changing the order of the mapped directories.

Specified by:
updateDirectoryMapping in interface ApplicationDAO
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

updateDirectoryMapping

public void updateDirectoryMapping(long applicationId,
                                   long directoryId,
                                   boolean allowAllToAuthenticate)
                            throws ApplicationNotFoundException,
                                   DirectoryNotFoundException
Description copied from interface: ApplicationDAO
Updates a directory mapping.

Specified by:
updateDirectoryMapping in interface ApplicationDAO
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

public void updateDirectoryMapping(long applicationId,
                                   long directoryId,
                                   boolean allowAllToAuthenticate,
                                   Set<OperationType> operationTypes)
                            throws ApplicationNotFoundException,
                                   DirectoryNotFoundException
Description copied from interface: ApplicationDAO
Updates a directory mapping.

Specified by:
updateDirectoryMapping in interface ApplicationDAO
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.

setAliasDao

@Autowired
public void setAliasDao(AliasDAO aliasDao)

setDirectoryDao

@Autowired
public void setDirectoryDao(DirectoryDao directoryDao)

setHqlQueryTranslater

@Autowired
public void setHqlQueryTranslater(HQLQueryTranslater hqlQueryTranslater)


Copyright © 2013 Atlassian. All Rights Reserved.