public final class ApplicationUsers extends Object
ApplicationUser from a directory User.| Constructor and Description |
|---|
ApplicationUsers() |
| Modifier and Type | Method and Description |
|---|---|
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 List<ApplicationUser> |
from(Iterable<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. |
@Nullable public static ApplicationUser from(@Nullable com.atlassian.crowd.embedded.api.User user)
user - the directory Usernull 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 UserUser, 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 nullIllegalStateException - 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<ApplicationUser> from(@Nullable Iterable<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 nullIllegalStateException - 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@Nullable 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 keynull if no user exists with that key.Copyright © 2002-2021 Atlassian. All Rights Reserved.