public class

MockUserKeyService

extends Object
implements UserKeyService
java.lang.Object
   ↳ com.atlassian.jira.user.MockUserKeyService

Summary

Public Constructors
MockUserKeyService()
Public Methods
String getKeyForUser(User user)
This convenience method is equivalent to getKeyForUsername(user.getName()), except that it is null-safe.
String getKeyForUsername(String username)
Returns the key that is associated with the given username.
String getUsernameForKey(String key)
Returns the (lower-cased) username that is associated with the given key.
void setMapping(String key, String username)
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.user.UserKeyService

Public Constructors

public MockUserKeyService ()

Public Methods

public String getKeyForUser (User user)

This convenience method is equivalent to getKeyForUsername(user.getName()), except that it is null-safe.

Parameters
user the user to resolve to a key (may be null)
Returns

public String getKeyForUsername (String username)

Returns the key that is associated with the given username. Normally this mapping is retained even for deleted users.

Parameters
username the username to resolve to a key (may be null)
Returns
  • the key that is currently associated with the username, or null if username is null or unmapped. Note that a non-null result does not guarantee that the user still exists.

public String getUsernameForKey (String key)

Returns the (lower-cased) username that is associated with the given key. Normally this mapping is retained even for deleted users.

Note that this returns the lower-case of the username (because username must act case-insensitive in our key->username map).

Parameters
key the key to resolve to a username (may be null)
Returns
  • the username that is currently associated with the key, or null if key is null or unmapped. Note that a non-null result does not guarantee that the user still exists.

public void setMapping (String key, String username)