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, timeSourceFields inherited from class com.atlassian.crowd.util.persistence.hibernate.StatelessDao
sessionFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(Application application, PasswordCredential passwordCredential) Will only create the core attributes to an application, i.e. this will not create directory mappings (thus group mappings).voidaddDirectoryMapping(long applicationId, long directoryId, boolean allowAllToAuthenticate, OperationType... operationTypes) Adds a mapping between application and directory.voidaddGroupMapping(long applicationId, long directoryId, String groupName) Adds a group mapping.voidaddRemoteAddress(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.voidremove(Application application) Removes the application.voidremoveDirectoryMapping(long applicationId, long directoryId) Removes a mapping between application and directory.voidremoveDirectoryMappings(long directoryId) Removes all the mappings associated with the given directory identified by directory id.voidremoveGroupMapping(long applicationId, long directoryId, String groupName) Removes a group mapping.voidremoveGroupMappings(long directoryId, String groupName) Removes group mappings.voidremoveRemoteAddress(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.voidsetAliasDao(AliasDAO aliasDao) voidsetApplicationDefaultGroupMembershipConfigurationDao(ApplicationDefaultGroupMembershipConfigurationDao applicationDefaultGroupMembershipConfigurationDao) voidsetDirectoryDao(DirectoryDao directoryDao) voidsetHqlQueryTranslater(HQLQueryTranslater hqlQueryTranslater) voidsetLicensingSummaryDao(LicensingSummaryDao licensingSummaryDao) voidsetUserPermissionDAO(InternalUserPermissionDAO userPermissionDAO) update(Application application) Will only update the core attributes to an application, i.e. this will not update directory mappings (thus group mappings).voidupdateCredential(Application application, PasswordCredential passwordCredential) Updates credential of the given application.voidupdateDirectoryMapping(long applicationId, long directoryId, boolean allowAllToAuthenticate) Updates a directory mapping.voidupdateDirectoryMapping(long applicationId, long directoryId, boolean allowAllToAuthenticate, Set<OperationType> operationTypes) Updates a directory mapping.voidupdateDirectoryMapping(long applicationId, long directoryId, int position) Updates the ordering of directory mappings for an application.protected voidupdateInternal(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, updateMethods inherited from class com.atlassian.crowd.util.persistence.hibernate.StatelessDao
setSessionFactory, withStatelessSession
-
Constructor Details
-
ApplicationDAOHibernate
public ApplicationDAOHibernate()
-
-
Method Details
-
add
Description copied from interface:ApplicationDAOWill only create the core attributes to an application, i.e. this will not create directory mappings (thus group mappings).- Specified by:
addin 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:ApplicationDAOAdds a mapping between application and directory. Both are identified by ids.- Specified by:
addDirectoryMappingin 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:ApplicationDAOAdds a group mapping.- Specified by:
addGroupMappingin 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:ApplicationDAOAssociates a remote address to the given application.- Specified by:
addRemoteAddressin interfaceApplicationDAO- Parameters:
applicationId- Application id.remoteAddress- Remote address.- Throws:
ApplicationNotFoundException- If the application cannot be found.
-
findAuthorisedApplications
Description copied from interface:ApplicationDAOFinds all applications that a user from a given directory belonging to the specified groups can authenticate to.- Specified by:
findAuthorisedApplicationsin 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:ApplicationDAOFinds application by application id.- Specified by:
findByIdin interfaceApplicationDAO- Parameters:
id- Application id.- Returns:
- Application.
- Throws:
ApplicationNotFoundException- If application of the specified id does not exist.
-
findByName
Description copied from interface:ApplicationDAOFinds application by application name, in a case-insensitive way.- Specified by:
findByNamein interfaceApplicationDAO- Parameters:
name- Application name.- Returns:
- Application.
- Throws:
ApplicationNotFoundException- If application of the specified name does not exist.
-
getPersistentClass
Description copied from class:HibernateDaoAll subclasses of HibernateDao must implement this method forHibernateDao.load(Serializable)to work correctly.- Specified by:
getPersistentClassin classHibernateDao<ApplicationImpl>- Returns:
- the entity class for this DAO
-
remove
Description copied from interface:ApplicationDAORemoves the application. All its aliases will also be removed.- Specified by:
removein interfaceApplicationDAO- Parameters:
application- The application.
-
removeDirectoryMapping
public void removeDirectoryMapping(long applicationId, long directoryId) throws ApplicationNotFoundException Description copied from interface:ApplicationDAORemoves a mapping between application and directory. Both are identified by ids.- Specified by:
removeDirectoryMappingin 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:ApplicationDAORemoves all the mappings associated with the given directory identified by directory id.- Specified by:
removeDirectoryMappingsin interfaceApplicationDAO- Parameters:
directoryId- Directory id.
-
removeGroupMapping
public void removeGroupMapping(long applicationId, long directoryId, String groupName) throws ApplicationNotFoundException Description copied from interface:ApplicationDAORemoves a group mapping.- Specified by:
removeGroupMappingin interfaceApplicationDAO- Parameters:
applicationId- Application id.directoryId- Directory id.groupName- Group name.- Throws:
ApplicationNotFoundException
-
removeGroupMappings
Description copied from interface:ApplicationDAORemoves group mappings.- Specified by:
removeGroupMappingsin interfaceApplicationDAO- Parameters:
directoryId- Directory id.groupName- Group name.
-
removeRemoteAddress
public void removeRemoteAddress(long applicationId, RemoteAddress remoteAddress) throws ApplicationNotFoundException Description copied from interface:ApplicationDAODissociates the given remote address from the given application.- Specified by:
removeRemoteAddressin interfaceApplicationDAO- Parameters:
applicationId- Application id.remoteAddress- Remote address, not null.- Throws:
ApplicationNotFoundException- If the application cannot be found.
-
search
Description copied from interface:ApplicationDAOWill search for all the applications which qualify for the givenEntityQuery.- Specified by:
searchin interfaceApplicationDAO- Parameters:
query- Entity query of typeEntityDescriptor.application().- Returns:
- A list of applications (could be empty).
-
update
Description copied from interface:ApplicationDAOWill 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:
updatein 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:ApplicationDAOUpdates credential of the given application.- Specified by:
updateCredentialin 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:ApplicationDAOUpdates the ordering of directory mappings for an application. This method only has the effect of changing the order of the mapped directories.- Specified by:
updateDirectoryMappingin 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:ApplicationDAOUpdates a directory mapping.- Specified by:
updateDirectoryMappingin 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:ApplicationDAOUpdates a directory mapping.- Specified by:
updateDirectoryMappingin 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:ApplicationDAOFinds the directory mapping for a given application and directory combination- Specified by:
findDirectoryMappingin 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
-