public class

OfBizUserDao

extends Object
implements UserDao
java.lang.Object
   ↳ com.atlassian.jira.crowd.embedded.ofbiz.OfBizUserDao

Class Overview

Implementation of the user DAO that works with OfBiz

Summary

Public Constructors
OfBizUserDao(OfBizDelegator ofBizDelegator, DirectoryDao directoryDao, InternalMembershipDao membershipDao, UserKeyStore userKeyStore, UserDeleteVeto userDeleteVeto, CacheManager cacheManager, ClusterLockService clusterLockService, ApplicationProperties applicationProperties)
Public Methods
User add(User user, PasswordCredential credential)
@Nonnull BatchResult<User> addAll(Set<UserTemplateWithCredentialAndAttributes> users)
@Nonnull OfBizUser findByExternalId(long directoryId, String externalId)
@Nonnull TimestampedUser findByName(long directoryId, String userName)
@Nonnull UserWithAttributes findByNameWithAttributes(long directoryId, String userName)
Collection<String> findNamesOfUsersInGroups(Collection<String> groupNames)
Returns the lower-cased names of all users in the specified groups.
void flushCache()
Invoked by OfBizCacheFlushingManager to ensure caches are being flushed in the right order on XMLRestoreFinishedEvent
Collection<String> getAllAttributeKeys()
Set<String> getAllExternalIds(long directoryId)
@Nullable PasswordCredential getCredential(long directoryId, String userName)
List<PasswordCredential> getCredentialHistory(long directoryId, String userName)
long getUniqueUserCount(Set<Long> directoryIds)
long getUserCount(long directoryId)
boolean isCacheInitialized()
We check if the cache is initialized or not.
void processUsers(Consumer<? super User> userProcessor)
Performs an operation on every user in the system.
void remove(User user)
BatchResult<String> removeAllUsers(long directoryId, Set<String> userNames)
void removeAttribute(User user, String attributeName)
User rename(User oldUser, String newName)
<T> List<T> search(long directoryId, EntityQuery<T> query)
void setAttributeForAllInDirectory(long directoryId, String attrName, String attrValue)
void storeAttributes(User user, Map<StringSet<String>> attributes)
User update(User user)
void updateCredential(User user, PasswordCredential credential, int credentialHistory)
boolean useFullCache()
Protected Methods
void updateGroupMembership(long directoryId, String oldName, String newName)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.crowd.embedded.spi.UserDao

Public Constructors

public OfBizUserDao (OfBizDelegator ofBizDelegator, DirectoryDao directoryDao, InternalMembershipDao membershipDao, UserKeyStore userKeyStore, UserDeleteVeto userDeleteVeto, CacheManager cacheManager, ClusterLockService clusterLockService, ApplicationProperties applicationProperties)

Public Methods

public User add (User user, PasswordCredential credential)

Throws
UserAlreadyExistsException

@Nonnull public BatchResult<User> addAll (Set<UserTemplateWithCredentialAndAttributes> users)

@Nonnull public OfBizUser findByExternalId (long directoryId, String externalId)

@Nonnull public TimestampedUser findByName (long directoryId, String userName)

@Nonnull public UserWithAttributes findByNameWithAttributes (long directoryId, String userName)

public Collection<String> findNamesOfUsersInGroups (Collection<String> groupNames)

Returns 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.

Parameters
groupNames the names of the groups to search.
Returns
  • set of all user names in these groups, in lower case.

public void flushCache ()

Invoked by OfBizCacheFlushingManager to ensure caches are being flushed in the right order on XMLRestoreFinishedEvent

public Collection<String> getAllAttributeKeys ()

public Set<String> getAllExternalIds (long directoryId)

@Nullable public PasswordCredential getCredential (long directoryId, String userName)

public List<PasswordCredential> getCredentialHistory (long directoryId, String userName)

public long getUniqueUserCount (Set<Long> directoryIds)

public long getUserCount (long directoryId)

public boolean isCacheInitialized ()

We check if the cache is initialized or not. This is an important cache to see if jira is available or not for the users to login.

Returns
  • true if the cache is initialized, false if not.

public void processUsers (Consumer<? super User> userProcessor)

Performs 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 userProcessor consumer.

Parameters
userProcessor the operation to perform on each user.

public void remove (User user)

public BatchResult<String> removeAllUsers (long directoryId, Set<String> userNames)

public void removeAttribute (User user, String attributeName)

public User rename (User oldUser, String newName)

public List<T> search (long directoryId, EntityQuery<T> query)

public void setAttributeForAllInDirectory (long directoryId, String attrName, String attrValue)

public void storeAttributes (User user, Map<StringSet<String>> attributes)

public User update (User user)

public void updateCredential (User user, PasswordCredential credential, int credentialHistory)

public boolean useFullCache ()

Protected Methods

protected void updateGroupMembership (long directoryId, String oldName, String newName)