Class IndexedUserDao
java.lang.Object
com.atlassian.jira.crowd.embedded.ofbiz.IndexedUserDao
- All Implemented Interfaces:
com.atlassian.crowd.embedded.spi.UserDao,ExtendedUserDao
Optimizes full text search.
Some queries might be unsuitable for the optimization. In such cases it falls back to the unoptimized search.
It's cluster-safe with the caveat of eventual consistency.
-
Constructor Summary
ConstructorsConstructorDescriptionIndexedUserDao(ExtendedUserDao dao, UserIndexer indexer, CrowdQueryTranslator translator, ClusterMessagingService clusterMessagingService, OfBizTransactionManager ofBizTransactionManager, int maxBatchSize, com.atlassian.event.api.EventPublisher eventPublisher, UserKeyStore userKeyStore) -
Method Summary
Modifier and TypeMethodDescriptioncom.atlassian.crowd.model.user.Useradd(com.atlassian.crowd.model.user.User user, com.atlassian.crowd.embedded.api.PasswordCredential credential) com.atlassian.crowd.util.BatchResult<com.atlassian.crowd.model.user.User>protected final ExtendedUserDaodelegate()findAllByNameOrNull(long directoryId, Collection<String> userNames) com.atlassian.crowd.model.user.TimestampedUserfindByExternalId(long directoryId, String externalId) findByExternalIds(long directoryId, Set<String> externalIds) findById(long internalUserId) Finds a user by internal user ID.com.atlassian.crowd.model.user.TimestampedUserfindByName(long directoryId, String userName) findByNameOrNull(long directoryId, String userName) Tries to find the user by name and returns null if not found.com.atlassian.crowd.model.user.UserWithAttributesfindByNameWithAttributes(long directoryId, String userName) findDirectoryIdsContainingUserName(String username) findNamesOfUsersInGroups(Collection<String> groupNames) Returns the lower-cased names of all users in the specified groups.findOfBizUser(long directoryId, String userName) voidInvoked byOfBizCacheFlushingManagerto ensure caches are being flushed in the right order onXMLRestoreFinishedEventgetAllExternalIds(long directoryId) com.atlassian.crowd.embedded.api.PasswordCredentialgetCredential(long directoryId, String userName) List<com.atlassian.crowd.embedded.api.PasswordCredential>getCredentialHistory(long directoryId, String userName) longgetUniqueUserCount(Set<Long> directoryIds) longgetUserCount(long directoryId) booleanisDeletedExternally(long internalUserId) Checks if user (identified by internal user ID) has been deleted from external user directory.booleanisDeletedExternally(long directoryId, String userName) Checks if user (identified by directory ID and user name) has been deleted from external user directory.voidvoidprocessUsers(Consumer<? super com.atlassian.crowd.model.user.User> userProcessor) Performs an operation on every user in the system.voidremove(com.atlassian.crowd.model.user.User user) com.atlassian.crowd.util.BatchResult<String>removeAllUsers(long directoryId, Set<String> userNames) voidremoveAttribute(com.atlassian.crowd.model.user.User user, String attributeName) com.atlassian.crowd.model.user.User<T> List<T>search(long directoryId, com.atlassian.crowd.search.query.entity.EntityQuery<T> query) voidsetAttributeForAllInDirectory(long directoryId, String attrName, String attrValue) voidstoreAttributes(com.atlassian.crowd.model.user.User user, Map<String, Set<String>> attributes, boolean updateTimestamp) com.atlassian.crowd.model.user.Userupdate(com.atlassian.crowd.model.user.User user) com.atlassian.crowd.model.user.Userupdate(com.atlassian.crowd.model.user.User user, boolean useJiraExtensions) Updates user, for detailed description seeUserDao.update(com.atlassian.crowd.model.user.User).voidupdateCredential(com.atlassian.crowd.model.user.User user, com.atlassian.crowd.embedded.api.PasswordCredential credential, int maxCredentialHistory) booleanboolean
-
Constructor Details
-
IndexedUserDao
public IndexedUserDao(ExtendedUserDao dao, UserIndexer indexer, CrowdQueryTranslator translator, ClusterMessagingService clusterMessagingService, OfBizTransactionManager ofBizTransactionManager, int maxBatchSize, com.atlassian.event.api.EventPublisher eventPublisher, UserKeyStore userKeyStore)
-
-
Method Details
-
delegate
-
add
public com.atlassian.crowd.model.user.User add(com.atlassian.crowd.model.user.User user, com.atlassian.crowd.embedded.api.PasswordCredential credential) throws com.atlassian.crowd.exception.UserAlreadyExistsException, IllegalArgumentException, com.atlassian.crowd.exception.DirectoryNotFoundException - Specified by:
addin interfacecom.atlassian.crowd.embedded.spi.UserDao- Throws:
com.atlassian.crowd.exception.UserAlreadyExistsExceptionIllegalArgumentExceptioncom.atlassian.crowd.exception.DirectoryNotFoundException
-
addAll
public com.atlassian.crowd.util.BatchResult<com.atlassian.crowd.model.user.User> addAll(Set<com.atlassian.crowd.model.user.UserTemplateWithCredentialAndAttributes> users) - Specified by:
addAllin interfacecom.atlassian.crowd.embedded.spi.UserDao
-
rename
public com.atlassian.crowd.model.user.User rename(com.atlassian.crowd.model.user.User user, String newName) throws com.atlassian.crowd.exception.UserNotFoundException, com.atlassian.crowd.exception.UserAlreadyExistsException, IllegalArgumentException - Specified by:
renamein interfacecom.atlassian.crowd.embedded.spi.UserDao- Throws:
com.atlassian.crowd.exception.UserNotFoundExceptioncom.atlassian.crowd.exception.UserAlreadyExistsExceptionIllegalArgumentException
-
update
public com.atlassian.crowd.model.user.User update(com.atlassian.crowd.model.user.User user) throws com.atlassian.crowd.exception.UserNotFoundException, IllegalArgumentException - Specified by:
updatein interfacecom.atlassian.crowd.embedded.spi.UserDao- Throws:
com.atlassian.crowd.exception.UserNotFoundExceptionIllegalArgumentException
-
remove
public void remove(com.atlassian.crowd.model.user.User user) throws com.atlassian.crowd.exception.UserNotFoundException - Specified by:
removein interfacecom.atlassian.crowd.embedded.spi.UserDao- Throws:
com.atlassian.crowd.exception.UserNotFoundException
-
removeAllUsers
public com.atlassian.crowd.util.BatchResult<String> removeAllUsers(long directoryId, Set<String> userNames) - Specified by:
removeAllUsersin interfacecom.atlassian.crowd.embedded.spi.UserDao
-
search
public <T> List<T> search(long directoryId, com.atlassian.crowd.search.query.entity.EntityQuery<T> query) - Specified by:
searchin interfacecom.atlassian.crowd.embedded.spi.UserDao
-
flushCache
public void flushCache()Description copied from interface:ExtendedUserDaoInvoked byOfBizCacheFlushingManagerto ensure caches are being flushed in the right order onXMLRestoreFinishedEvent- Specified by:
flushCachein interfaceExtendedUserDao
-
onApplicationStarted
-
useFullCache
public boolean useFullCache()- Specified by:
useFullCachein interfaceExtendedUserDao
-
useInternedUserValues
public boolean useInternedUserValues()- Specified by:
useInternedUserValuesin interfaceExtendedUserDao
-
getUniqueUserCount
public long getUniqueUserCount(Set<Long> directoryIds) throws com.atlassian.crowd.exception.DirectoryNotFoundException - Specified by:
getUniqueUserCountin interfaceExtendedUserDao- Throws:
com.atlassian.crowd.exception.DirectoryNotFoundException
-
findNamesOfUsersInGroups
Description copied from interface:ExtendedUserDaoReturns the lower-cased names of all users in the specified groups. Only searches directly in these groups, if a recursive group search is required the caller will need to pre-expand the groups.- Specified by:
findNamesOfUsersInGroupsin interfaceExtendedUserDao- Parameters:
groupNames- the names of the groups to search.- Returns:
- set of all user names in these groups, in lower case.
-
getAllAttributeKeys
- Specified by:
getAllAttributeKeysin interfaceExtendedUserDao
-
processUsers
Description copied from interface:ExtendedUserDaoPerforms an operation on every user in the system.This can be a time-consuming operation on JIRA instances that contain many users. It is recommended to use one of the search methods where possible.
This method performs a live iteration over a database result set. Care must be taken if additional database operations are performed within the
userProcessorconsumer.- Specified by:
processUsersin interfaceExtendedUserDao- Parameters:
userProcessor- the operation to perform on each user.
-
findByName
public com.atlassian.crowd.model.user.TimestampedUser findByName(long directoryId, String userName) throws com.atlassian.crowd.exception.UserNotFoundException - Specified by:
findByNamein interfacecom.atlassian.crowd.embedded.spi.UserDao- Throws:
com.atlassian.crowd.exception.UserNotFoundException
-
findByExternalId
public com.atlassian.crowd.model.user.TimestampedUser findByExternalId(long directoryId, String externalId) throws com.atlassian.crowd.exception.UserNotFoundException - Specified by:
findByExternalIdin interfacecom.atlassian.crowd.embedded.spi.UserDao- Throws:
com.atlassian.crowd.exception.UserNotFoundException
-
findByNameWithAttributes
public com.atlassian.crowd.model.user.UserWithAttributes findByNameWithAttributes(long directoryId, String userName) throws com.atlassian.crowd.exception.UserNotFoundException - Specified by:
findByNameWithAttributesin interfacecom.atlassian.crowd.embedded.spi.UserDao- Throws:
com.atlassian.crowd.exception.UserNotFoundException
-
getCredential
public com.atlassian.crowd.embedded.api.PasswordCredential getCredential(long directoryId, String userName) throws com.atlassian.crowd.exception.UserNotFoundException - Specified by:
getCredentialin interfacecom.atlassian.crowd.embedded.spi.UserDao- Throws:
com.atlassian.crowd.exception.UserNotFoundException
-
getCredentialHistory
public List<com.atlassian.crowd.embedded.api.PasswordCredential> getCredentialHistory(long directoryId, String userName) throws com.atlassian.crowd.exception.UserNotFoundException - Specified by:
getCredentialHistoryin interfacecom.atlassian.crowd.embedded.spi.UserDao- Throws:
com.atlassian.crowd.exception.UserNotFoundException
-
updateCredential
public void updateCredential(com.atlassian.crowd.model.user.User user, com.atlassian.crowd.embedded.api.PasswordCredential credential, int maxCredentialHistory) throws com.atlassian.crowd.exception.UserNotFoundException, IllegalArgumentException - Specified by:
updateCredentialin interfacecom.atlassian.crowd.embedded.spi.UserDao- Throws:
com.atlassian.crowd.exception.UserNotFoundExceptionIllegalArgumentException
-
removeAttribute
public void removeAttribute(com.atlassian.crowd.model.user.User user, String attributeName) throws com.atlassian.crowd.exception.UserNotFoundException - Specified by:
removeAttributein interfacecom.atlassian.crowd.embedded.spi.UserDao- Throws:
com.atlassian.crowd.exception.UserNotFoundException
-
setAttributeForAllInDirectory
- Specified by:
setAttributeForAllInDirectoryin interfacecom.atlassian.crowd.embedded.spi.UserDao
-
findOfBizUser
- Specified by:
findOfBizUserin interfaceExtendedUserDao- Throws:
UserNotFoundException
-
findAllByNameOrNull
- Specified by:
findAllByNameOrNullin interfaceExtendedUserDao
-
findByNameOrNull
Description copied from interface:ExtendedUserDaoTries to find the user by name and returns null if not found. Just like the public method should have done in the first place!- Specified by:
findByNameOrNullin interfaceExtendedUserDao- Parameters:
directoryId- Directory IDuserName- the username- Returns:
- the user, or
nullif the user does not exist
-
getAllExternalIds
public Set<String> getAllExternalIds(long directoryId) throws com.atlassian.crowd.exception.DirectoryNotFoundException - Specified by:
getAllExternalIdsin interfacecom.atlassian.crowd.embedded.spi.UserDao- Throws:
com.atlassian.crowd.exception.DirectoryNotFoundException
-
getUserCount
public long getUserCount(long directoryId) throws com.atlassian.crowd.exception.DirectoryNotFoundException - Specified by:
getUserCountin interfacecom.atlassian.crowd.embedded.spi.UserDao- Throws:
com.atlassian.crowd.exception.DirectoryNotFoundException
-
findById
Description copied from interface:ExtendedUserDaoFinds a user by internal user ID.- Specified by:
findByIdin interfaceExtendedUserDao- Parameters:
internalUserId- the user ID.- Returns:
- the found user, or null if not found.
-
isDeletedExternally
public boolean isDeletedExternally(long internalUserId) Description copied from interface:ExtendedUserDaoChecks if user (identified by internal user ID) has been deleted from external user directory.- Specified by:
isDeletedExternallyin interfaceExtendedUserDao- Parameters:
internalUserId- the user ID.- Returns:
- true if user has been deleted from external directory, false otherwise.
-
isDeletedExternally
Description copied from interface:ExtendedUserDaoChecks if user (identified by directory ID and user name) has been deleted from external user directory.- Specified by:
isDeletedExternallyin interfaceExtendedUserDao- Parameters:
directoryId- Directory IDuserName- the username- Returns:
- true if user has been deleted from external directory, false otherwise.
-
update
public com.atlassian.crowd.model.user.User update(com.atlassian.crowd.model.user.User user, boolean useJiraExtensions) throws UserNotFoundException Description copied from interface:ExtendedUserDaoUpdates user, for detailed description seeUserDao.update(com.atlassian.crowd.model.user.User).- Specified by:
updatein interfaceExtendedUserDao- Parameters:
user- the user details, which should have the same name as the user to modifyuseJiraExtensions- Whether jira extensions should be run. Currently only extension is that when externally deleted user is updated (inactive and flagged) "externally deleted" flag is cleared and user is made active.- Returns:
- the updated user
- Throws:
UserNotFoundException- if there is no user with the same name (case-insensitive) and directory as the user provided- See Also:
-
UserDao.update(com.atlassian.crowd.model.user.User)
-
storeAttributes
public void storeAttributes(com.atlassian.crowd.model.user.User user, Map<String, Set<String>> attributes, boolean updateTimestamp) throws com.atlassian.crowd.exception.UserNotFoundException- Specified by:
storeAttributesin interfacecom.atlassian.crowd.embedded.spi.UserDao- Throws:
com.atlassian.crowd.exception.UserNotFoundException
-
findDirectoryIdsContainingUserName
- Specified by:
findDirectoryIdsContainingUserNamein interfacecom.atlassian.crowd.embedded.spi.UserDao
-
findByExternalIds
- Specified by:
findByExternalIdsin interfacecom.atlassian.crowd.embedded.spi.UserDao
-