Class ApplicationDAOHibernate
java.lang.Object
com.atlassian.crowd.util.persistence.hibernate.StatelessDao
com.atlassian.crowd.util.persistence.hibernate.HibernateDao<ApplicationImpl>
com.atlassian.crowd.dao.application.ApplicationDAOHibernate
- All Implemented Interfaces:
ApplicationDAO
public class ApplicationDAOHibernate
extends HibernateDao<ApplicationImpl>
implements ApplicationDAO
-
Field Summary
Fields inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao
batchFinder, batchProcessor, logger, statelessSessionBatchProcessor, timeSource
Fields inherited from class com.atlassian.crowd.util.persistence.hibernate.StatelessDao
sessionFactory
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(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.findAuthorisedApplications
(long directoryId, List<String> groupNames) Finds all applications that a user from a given directory belonging to the specified groups can authenticate to.findById
(long id) Finds application by application id.findByName
(String name) Finds application by application name, in a case-insensitive way.findDirectoryMapping
(long applicationId, long directoryId) Finds the directory mapping for a given application and directory combinationAll subclasses of HibernateDao must implement this method forHibernateDao.load(Serializable)
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.search
(EntityQuery<Application> query) Will search for all the applications which qualify for the givenEntityQuery
.void
setAliasDao
(AliasDAO aliasDao) void
setApplicationDefaultGroupMembershipConfigurationDao
(ApplicationDefaultGroupMembershipConfigurationDao applicationDefaultGroupMembershipConfigurationDao) void
setDirectoryDao
(DirectoryDao directoryDao) void
setHqlQueryTranslater
(HQLQueryTranslater hqlQueryTranslater) void
setLicensingSummaryDao
(LicensingSummaryDao licensingSummaryDao) void
setUserPermissionDAO
(InternalUserPermissionDAO userPermissionDAO) 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.protected void
updateInternal
(ApplicationImpl application) Methods inherited from class com.atlassian.crowd.util.persistence.hibernate.HibernateDao
createDeleteQuery, createDeleteQuery, createQuery, createQuery, executeHQLQuery, findAllInternal, findByProperties, findByPropertiesOptional, findByProperty, findByProperty, findByPropertyOptional, findByPropertyOrThrow, getCountByProperties, load, load, loadOptional, loadReference, loadReference, remove, removeByIdIfPresent, save, saveOrUpdate, session, setBatchFinder, setBatchProcessor, setClock, setStatelessSessionBatchProcessor, toPredicates, update
Methods inherited from class com.atlassian.crowd.util.persistence.hibernate.StatelessDao
setSessionFactory, withStatelessSession
-
Constructor Details
-
ApplicationDAOHibernate
public ApplicationDAOHibernate()
-
-
Method Details
-
add
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 interfaceApplicationDAO
- 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 interfaceApplicationDAO
- 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 interfaceApplicationDAO
- 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 interfaceApplicationDAO
- Parameters:
applicationId
- Application id.remoteAddress
- Remote address.- Throws:
ApplicationNotFoundException
- If the application cannot be found.
-
findAuthorisedApplications
Description copied from interface:ApplicationDAO
Finds all applications that a user from a given directory belonging to the specified groups can authenticate to.- Specified by:
findAuthorisedApplications
in interfaceApplicationDAO
- Parameters:
directoryId
- directory id of the user.groupNames
- group memberships of the user in the particular directory.- Returns:
- list of applications the user can authenticate to.
-
findById
Description copied from interface:ApplicationDAO
Finds application by application id.- Specified by:
findById
in interfaceApplicationDAO
- Parameters:
id
- Application id.- Returns:
- Application.
- Throws:
ApplicationNotFoundException
- If application of the specified id does not exist.
-
findByName
Description copied from interface:ApplicationDAO
Finds application by application name, in a case-insensitive way.- Specified by:
findByName
in interfaceApplicationDAO
- Parameters:
name
- Application name.- Returns:
- Application.
- Throws:
ApplicationNotFoundException
- If application of the specified name does not exist.
-
getPersistentClass
Description copied from class:HibernateDao
All subclasses of HibernateDao must implement this method forHibernateDao.load(Serializable)
to work correctly.- Specified by:
getPersistentClass
in classHibernateDao<ApplicationImpl>
- Returns:
- the entity class for this DAO
-
remove
Description copied from interface:ApplicationDAO
Removes the application. All its aliases will also be removed.- Specified by:
remove
in interfaceApplicationDAO
- 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 interfaceApplicationDAO
- 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 interfaceApplicationDAO
- 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 interfaceApplicationDAO
- Parameters:
applicationId
- Application id.directoryId
- Directory id.groupName
- Group name.- Throws:
ApplicationNotFoundException
-
removeGroupMappings
Description copied from interface:ApplicationDAO
Removes group mappings.- Specified by:
removeGroupMappings
in interfaceApplicationDAO
- 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 interfaceApplicationDAO
- Parameters:
applicationId
- Application id.remoteAddress
- Remote address, not null.- Throws:
ApplicationNotFoundException
- If the application cannot be found.
-
search
Description copied from interface:ApplicationDAO
Will search for all the applications which qualify for the givenEntityQuery
.- Specified by:
search
in interfaceApplicationDAO
- Parameters:
query
- Entity query of typeEntityDescriptor.application()
.- Returns:
- A list of applications (could be empty).
-
update
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 interfaceApplicationDAO
- 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 interfaceApplicationDAO
- 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 interfaceApplicationDAO
- Parameters:
applicationId
- Application iddirectoryId
- Directory idposition
- 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 foundDirectoryNotFoundException
- 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 interfaceApplicationDAO
- Parameters:
applicationId
- Application iddirectoryId
- 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 interfaceApplicationDAO
- Parameters:
applicationId
- Application iddirectoryId
- 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.
-
updateInternal
-
findDirectoryMapping
public DirectoryMapping findDirectoryMapping(long applicationId, long directoryId) throws DirectoryMappingNotFoundException Description copied from interface:ApplicationDAO
Finds the directory mapping for a given application and directory combination- Specified by:
findDirectoryMapping
in interfaceApplicationDAO
- Parameters:
applicationId
- Application iddirectoryId
- Directory id- Returns:
- the mapping for the given application and directory combination
- Throws:
DirectoryMappingNotFoundException
- If the directory mapping cannot be found
-
setAliasDao
-
setDirectoryDao
-
setUserPermissionDAO
-
setHqlQueryTranslater
-
setApplicationDefaultGroupMembershipConfigurationDao
@Autowired public void setApplicationDefaultGroupMembershipConfigurationDao(ApplicationDefaultGroupMembershipConfigurationDao applicationDefaultGroupMembershipConfigurationDao) -
setLicensingSummaryDao
-