com.atlassian.crowd.dao.application
Class ApplicationDAOHibernate

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by com.atlassian.crowd.util.persistence.hibernate.HibernateDao
              extended by com.atlassian.crowd.dao.application.ApplicationDAOHibernate
All Implemented Interfaces:
ApplicationDAO, org.springframework.beans.factory.InitializingBean

public class ApplicationDAOHibernate
extends HibernateDao
implements ApplicationDAO


Field Summary
 
Fields inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao
batchFinder, batchProcessor, logger
 
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, java.lang.String groupName)
          Adds a group mapping.
 void addRemoteAddress(long applicationId, RemoteAddress remoteAddress)
          Associates a remote address to the given application.
 java.util.List<Application> findAuthorisedApplications(long directoryId, java.util.List<java.lang.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(java.lang.String name)
          Finds application by application name, in a case-insensitive way.
 java.lang.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, java.lang.String groupName)
          Removes a group mapping.
 void removeGroupMappings(long directoryId, java.lang.String groupName)
          Removes group mappings.
 void removeRemoteAddress(long applicationId, RemoteAddress remoteAddress)
          Dissociates the given remote address from the given application.
 void renameGroupMappings(long directoryId, java.lang.String oldGroupName, java.lang.String newGroupName)
          Renames group mappings.
 java.util.List<Application> search(EntityQuery<Application> query)
          Will search for all the applications which qualify for the given EntityQuery.
 void setAliasDAO(AliasDAO aliasDAO)
           
 void setDirectoryDao(DirectoryDAOHibernate 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, java.util.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
load, loadReference, remove, save, saveOrUpdate, setBatchFinder, setBatchProcessor, update
 
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
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

getPersistentClass

public java.lang.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:
Class

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(java.lang.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.

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.

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.

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.

search

public java.util.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).

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.

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.

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.

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.

addGroupMapping

public void addGroupMapping(long applicationId,
                            long directoryId,
                            java.lang.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.

removeGroupMapping

public void removeGroupMapping(long applicationId,
                               long directoryId,
                               java.lang.String groupName)
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.

removeGroupMappings

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

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

renameGroupMappings

public void renameGroupMappings(long directoryId,
                                java.lang.String oldGroupName,
                                java.lang.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.

findAuthorisedApplications

public java.util.List<Application> findAuthorisedApplications(long directoryId,
                                                              java.util.List<java.lang.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.

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,
                                   java.util.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.

setHqlQueryTranslater

public void setHqlQueryTranslater(HQLQueryTranslater hqlQueryTranslater)

setAliasDAO

public void setAliasDAO(AliasDAO aliasDAO)

setDirectoryDao

public void setDirectoryDao(DirectoryDAOHibernate directoryDao)


Copyright © 2012 Atlassian. All Rights Reserved.