com.atlassian.confluence.user.persistence.dao.compatibility
Class FindUserHelper

java.lang.Object
  extended by 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
FindUserHelper()
           
 
Method Summary
static ConfluenceUser getUser(com.atlassian.user.User user)
           
static ConfluenceUser getUserByUserKey(com.atlassian.sal.api.user.UserKey userKey)
          Get a user by UserKey
static ConfluenceUser getUserByUsername(String username)
          Get a user by username.
static com.google.common.cache.Cache<com.atlassian.sal.api.user.UserKey,com.atlassian.fugue.Option<ConfluenceUser>> getUsersByKey()
          Returns a lazily populated map of user key -> user pairs.
static com.google.common.cache.Cache<String,com.atlassian.fugue.Option<ConfluenceUser>> getUsersByUsername()
          Returns a lazily populated map of usename -> user pairs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FindUserHelper

public FindUserHelper()
Method Detail

getUserByUsername

public static ConfluenceUser getUserByUsername(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 by UserKey

Parameters:
userKey -
Returns:
the identified user
Throws:
IllegalArgumentException - if no user can be found for the key

getUser

public static ConfluenceUser getUser(com.atlassian.user.User user)
Returns:
ConfluenceUser for the given user

getUsersByKey

public static com.google.common.cache.Cache<com.atlassian.sal.api.user.UserKey,com.atlassian.fugue.Option<ConfluenceUser>> getUsersByKey()
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

public static com.google.common.cache.Cache<String,com.atlassian.fugue.Option<ConfluenceUser>> getUsersByUsername()
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


Copyright © 2003–2015 Atlassian. All rights reserved.