|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.user.ApplicationUsers
public final class ApplicationUsers
Contains utility methods for getting an ApplicationUser
from a directory User
.
Constructor Summary | |
---|---|
ApplicationUsers()
|
Method Summary | |
---|---|
static ApplicationUser |
byKey(String key)
Gets the ApplicationUser in a null -safe manner. |
static List<ApplicationUser> |
from(Collection<com.atlassian.crowd.embedded.api.User> users)
Performs null -safe conversion of a collection of directory users
to corresponding ApplicationUser objects. |
static ApplicationUser |
from(com.atlassian.crowd.embedded.api.User user)
Obtains an ApplicationUser for the given directory User. |
static String |
getKeyFor(ApplicationUser user)
Get the key from the given user in a null-safe manner |
static String |
getKeyFor(com.atlassian.crowd.embedded.api.User user)
Gets the user key for the given directory User. |
static com.atlassian.crowd.embedded.api.User |
toDirectoryUser(ApplicationUser user)
Does a null-safe conversion from an application user to a directory user. |
static List<com.atlassian.crowd.embedded.api.User> |
toDirectoryUsers(Collection<ApplicationUser> applicationUsers)
Performs null -safe conversion of a collection of application users
to corresponding directory User objects. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ApplicationUsers()
Method Detail |
---|
public static ApplicationUser from(@Nullable com.atlassian.crowd.embedded.api.User user)
user
- the directory User
null
if the incoming user is null
.
IllegalStateException
- if user
is not null
, but the
UserKeyService
has no mapping for its username
.
This should not occur during normal operation, as all users are assigned keys
during the upgrade to v6.0 or when the user is created.@Nullable public static String getKeyFor(@Nullable com.atlassian.crowd.embedded.api.User user)
This is a null
-safe shorthand for
ApplicationUsers.from(user).getKey()
user
- the directory User
User
, or
null
if the incoming user is null
or has no mapping
in the UserKeyService
@Nullable public static String getKeyFor(@Nullable ApplicationUser user)
user
- the user (possibly null)
@Nullable public static com.atlassian.crowd.embedded.api.User toDirectoryUser(@Nullable ApplicationUser user)
user
- the ApplicationUser
@Nullable public static List<ApplicationUser> from(@Nullable Collection<com.atlassian.crowd.embedded.api.User> users)
null
-safe conversion of a collection of directory users
to corresponding ApplicationUser
objects.
users
- the users to transform (may be null
and may contain null
IllegalStateException
- if any of the users exists in the crowd
directory but has no mapping in the UserKeyService
(see
comments for from(User)
).@Nullable public static List<com.atlassian.crowd.embedded.api.User> toDirectoryUsers(@Nullable Collection<ApplicationUser> applicationUsers)
null
-safe conversion of a collection of application users
to corresponding directory User
objects.
applicationUsers
- the users to transform (may be null
and may contain null
public static ApplicationUser byKey(@Nullable String key)
ApplicationUser
in a null
-safe manner. This is a convenient
shorthand for ComponentAccessor.getUserManager().getUserByKey(key))
.
Prefer UserManager.getUserByKey(String)
when the UserManager
is
already available.
key
- the user's key
null
if no user exists with that key.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |