Class FindUserHelper
- java.lang.Object
-
- com.atlassian.confluence.user.persistence.dao.compatibility.FindUserHelper
-
public class FindUserHelper extends Object
A utility class that centralises the 'hackyness' involved during the period we support both username related APIs and the change to user keys.Find all usages of this class and you will find all the places that 'transitional hackyness' is taking place.
-
-
Constructor Summary
Constructors Constructor Description FindUserHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ConfluenceUsergetUser(@Nullable com.atlassian.user.User user)static ConfluenceUsergetUserByUserKey(com.atlassian.sal.api.user.UserKey userKey)Get a user byUserKeystatic @Nullable ConfluenceUsergetUserByUsername(@Nullable String username)Get a user by username.static com.google.common.cache.LoadingCache<com.atlassian.sal.api.user.UserKey,com.atlassian.fugue.Option<ConfluenceUser>>getUsersByKey()Deprecated.since 7.0.1.static com.google.common.cache.LoadingCache<String,com.atlassian.fugue.Option<ConfluenceUser>>getUsersByUsername()Deprecated.since 7.0.1.
-
-
-
Method Detail
-
getUserByUsername
public static @Nullable ConfluenceUser getUserByUsername(@Nullable String username)
Get a user by username.- Parameters:
username- the username of the user required- Returns:
- user with the given username or null if the username is null or empty or no user is found.
-
getUserByUserKey
public static ConfluenceUser getUserByUserKey(com.atlassian.sal.api.user.UserKey userKey)
Get a user byUserKey- Parameters:
userKey-- Returns:
- the identified user
- Throws:
IllegalArgumentException- if no user can be found for the key
-
getUser
public static ConfluenceUser getUser(@Nullable com.atlassian.user.User user)
- Returns:
- ConfluenceUser for the given user
-
getUsersByKey
@Deprecated public static com.google.common.cache.LoadingCache<com.atlassian.sal.api.user.UserKey,com.atlassian.fugue.Option<ConfluenceUser>> getUsersByKey()
Deprecated.since 7.0.1. UsegetUserByUserKey(UserKey)Returns a lazily populated map of user key -> user pairs.This method should only be used in backwards-compatibility code.
- Returns:
- lazily populated map of user key -> user pairs
-
getUsersByUsername
@Deprecated public static com.google.common.cache.LoadingCache<String,com.atlassian.fugue.Option<ConfluenceUser>> getUsersByUsername()
Deprecated.since 7.0.1. UsegetUserByUsername(String)Returns a lazily populated map of usename -> user pairs.This method should only be used in backwards-compatibility code.
- Returns:
- lazily populated map of usename -> user pairs
-
-