Package com.atlassian.jira.user
Interface UserKeyService
- All Known Implementing Classes:
MockUserKeyService
,UserKeyServiceImpl
public interface UserKeyService
A simple service to map userkeys to usernames.
- Since:
- v6.0
-
Method Summary
Modifier and TypeMethodDescriptiongetKeyForUser
(ApplicationUser user) This convenience method is equivalent togetKeyForUsername(user.getName())
, except that it isnull
-safe.getKeyForUsername
(String username) Returns the key that is associated with the given username.getUsernameForKey
(String key) Returns the (lower-cased) username that is associated with the given key.
-
Method Details
-
getUsernameForKey
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 benull
)- Returns:
- the username that is currently associated with the key, or
null
ifkey
isnull
or unmapped. Note that a non-null
result does not guarantee that the user still exists.
-
getKeyForUsername
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 benull
)- Returns:
- the key that is currently associated with the username, or
null
ifusername
isnull
or unmapped. Note that a non-null
result does not guarantee that the user still exists.
-
getKeyForUser
This convenience method is equivalent togetKeyForUsername(user.getName())
, except that it isnull
-safe.- Parameters:
user
- the user to resolve to a key (may benull
)- Returns:
- as for
getKeyForUsername(String)
-