Package com.atlassian.jira.user
Class MockUserKeyService
java.lang.Object
com.atlassian.jira.user.MockUserKeyService
- All Implemented Interfaces:
UserKeyService
-
Constructor Summary
Constructors -
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.voidsetMapping(String key, String username)
-
Constructor Details
-
MockUserKeyService
public MockUserKeyService()
-
-
Method Details
-
getUsernameForKey
Description copied from interface:UserKeyServiceReturns 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).
- Specified by:
getUsernameForKeyin interfaceUserKeyService- Parameters:
key- the key to resolve to a username (may benull)- Returns:
- the username that is currently associated with the key, or
nullifkeyisnullor unmapped. Note that a non-nullresult does not guarantee that the user still exists.
-
getKeyForUsername
Description copied from interface:UserKeyServiceReturns the key that is associated with the given username. Normally this mapping is retained even for deleted users.- Specified by:
getKeyForUsernamein interfaceUserKeyService- Parameters:
username- the username to resolve to a key (may benull)- Returns:
- the key that is currently associated with the username, or
nullifusernameisnullor unmapped. Note that a non-nullresult does not guarantee that the user still exists.
-
getKeyForUser
Description copied from interface:UserKeyServiceThis convenience method is equivalent togetKeyForUsername(user.getName()), except that it isnull-safe.- Specified by:
getKeyForUserin interfaceUserKeyService- Parameters:
user- the user to resolve to a key (may benull)- Returns:
- as for
UserKeyService.getKeyForUsername(String)
-
setMapping
-