@ParametersAreNonnullByDefault @ReturnValuesAreNonnullByDefault public class CachingConfluenceUserDao extends Object implements ConfluenceUserDao
Constructor and Description |
---|
CachingConfluenceUserDao(ConfluenceUserDao delegate,
com.atlassian.vcache.VCacheFactory cacheFactory) |
Modifier and Type | Method and Description |
---|---|
void |
create(ConfluenceUser user)
Create a new ConfluenceUser.
|
boolean |
createIfMissing(ConfluenceUser user)
Create a new ConfluenceUser or do nothing if it exists already.
|
ConfluenceUser |
findByKey(com.atlassian.sal.api.user.UserKey key)
Retrieve a ConfluenceUser by the user key.
|
Map<com.atlassian.sal.api.user.UserKey,Optional<ConfluenceUser>> |
findByKeys(Set<com.atlassian.sal.api.user.UserKey> userkeys)
Performs a bulk lookup of multiple
ConfluenceUser s. |
Map<String,ConfluenceUser> |
findByLowerNames(Iterable<String> usernames)
Bulk operation to find ConfluenceUser corresponding to lowercase name.
|
ConfluenceUser |
findByUsername(String username)
Attempts to find a
ConfluenceUser for the given username. |
Map<com.atlassian.sal.api.user.UserKey,String> |
findLowerNamesByKeys(Iterable<com.atlassian.sal.api.user.UserKey> keys)
Bulk operation to find lowercase name corresponding to user key.
|
Map<String,com.atlassian.sal.api.user.UserKey> |
findUserKeysByLowerNames(Iterable<String> names)
Bulk operation to find user key corresponding to lowercase name.
|
Set<ConfluenceUser> |
getAll() |
void |
remove(ConfluenceUser user)
Remove the supplied ConfluenceUser from persistence.
|
ConfluenceUser |
rename(String oldUsername,
String newUsername,
boolean overrideExisting)
Renames a user
|
void |
update(ConfluenceUser user)
Change a property of an existing ConfluenceUser.
|
public CachingConfluenceUserDao(ConfluenceUserDao delegate, com.atlassian.vcache.VCacheFactory cacheFactory)
public void create(ConfluenceUser user)
ConfluenceUserDao
create
in interface ConfluenceUserDao
public boolean createIfMissing(ConfluenceUser user)
ConfluenceUserDao
createIfMissing
in interface ConfluenceUserDao
public void update(ConfluenceUser user)
ConfluenceUserDao
update
in interface ConfluenceUserDao
public void remove(ConfluenceUser user)
ConfluenceUserDao
remove
in interface ConfluenceUserDao
public ConfluenceUser rename(String oldUsername, String newUsername, boolean overrideExisting)
ConfluenceUserDao
rename
in interface ConfluenceUserDao
oldUsername
- old username for the usernewUsername
- new username for the useroverrideExisting
- True if possible existing mapping should make
way for the renamed one. False for opposite
behaviour.@Nullable public ConfluenceUser findByKey(@Nullable com.atlassian.sal.api.user.UserKey key)
ConfluenceUserDao
findByKey
in interface ConfluenceUserDao
@Nullable public ConfluenceUser findByUsername(@Nullable String username)
ConfluenceUser
for the given username.
If the userkey for the given username is not cached, then the delegate DAO will be invoked to find the user for the username, and that user's key will then be added to the cache. Future lookups for that username will use the cached userkey and then find the user for that key (via the delegate DAO). This is the "normal" use-case.
If the delegate initially returns no user for the username, then the cache will be populated with an empty value (this is a requirement of the VCache API which requires value loaders to return *something*, even if it's just an Optional.empty). However, since new users can be added via other DAOs (e.g. during crowd sync), and this class isn't aware of such activity, then subsequent lookups for that username need to ignore this "empty" cached userkey and instead re-invoke the delegate DAO to re-lookup the user. This is a bit weird, but is necessary to work around this "back door" addition of users.
findByUsername
in interface ConfluenceUserDao
public Set<ConfluenceUser> getAll()
getAll
in interface ConfluenceUserDao
public Map<String,com.atlassian.sal.api.user.UserKey> findUserKeysByLowerNames(Iterable<String> names)
ConfluenceUserDao
findUserKeysByLowerNames
in interface ConfluenceUserDao
public Map<String,ConfluenceUser> findByLowerNames(Iterable<String> usernames)
ConfluenceUserDao
findByLowerNames
in interface ConfluenceUserDao
usernames
- lowercase user namespublic Map<com.atlassian.sal.api.user.UserKey,String> findLowerNamesByKeys(Iterable<com.atlassian.sal.api.user.UserKey> keys)
ConfluenceUserDao
findLowerNamesByKeys
in interface ConfluenceUserDao
public Map<com.atlassian.sal.api.user.UserKey,Optional<ConfluenceUser>> findByKeys(Set<com.atlassian.sal.api.user.UserKey> userkeys)
ConfluenceUserDao
ConfluenceUser
s.findByKeys
in interface ConfluenceUserDao
userkeys
- The set of UserKey
sMap
of UserKey
s to Optional
ConfluenceUser
s. Every UserKey
present in the userkeys parameter will have an entry in this map.Copyright © 2003–2017 Atlassian. All rights reserved.