@PublicApi @ParametersAreNullableByDefault public interface UserFactory
SDUser
and JIRA ApplicationUser
classes.
For most APIs in Jira Service Management we only allow the usage for logged in users. As ApplicationUser
is
null
for anonymous users the usage of SDUser
and its subclasses is mandatory for these APIs.
This allows APIs to be more specific that they need a logged in user.
This factory provides an easy way to convert ApplicationUser
to subclasses
Modifier and Type | Method and Description |
---|---|
CheckedUser |
getCheckedUser()
Helper method to wrap getCurrentUserByType[CheckedUser].
|
UncheckedUser |
getUncheckedUser()
Helper method to wrap getCurrentUserByType[UncheckedUser].
|
List<com.atlassian.jira.user.ApplicationUser> |
unwrap(Collection<CheckedUser> checkedUsers)
Map a list of
CheckedUser to a list of ApplicationUser . |
CheckedUser |
wrap(com.atlassian.jira.user.ApplicationUser appUser)
Returns a
CheckedUser from the application user or an error if an internal error occurred,
or the ApplicationUser was null . |
List<CheckedUser> |
wrap(Collection<com.atlassian.jira.user.ApplicationUser> appUsers)
Map a list of
ApplicationUser to a list of CheckedUser . |
UncheckedUser |
wrapUnchecked(com.atlassian.jira.user.ApplicationUser appUser)
Returns a
UncheckedUser from the application user. |
CheckedUser |
wrapUserKey(String userkey)
This turns a user key into a JIRA Application User and then wraps it up.
|
CheckedUser |
wrapUsername(String username)
This turns a username into a JIRA Application User and then wraps it up.
|
List<CheckedUser> |
wrapUsernames(Collection<String> usernames)
This turns
usernames into a JIRA Application User and then wraps them to CheckedUser . |
@Nonnull CheckedUser wrap(com.atlassian.jira.user.ApplicationUser appUser)
CheckedUser
from the application user or an error if an internal error occurred,
or the ApplicationUser was null
.appUser
- the application userServiceDeskServiceException
- on error@Nonnull UncheckedUser wrapUnchecked(com.atlassian.jira.user.ApplicationUser appUser)
UncheckedUser
from the application user.appUser
- the application user@Nonnull List<CheckedUser> wrap(@Nonnull Collection<com.atlassian.jira.user.ApplicationUser> appUsers)
ApplicationUser
to a list of CheckedUser
. Return an error if any ApplicationUser
can't be mapped. Reverse of unwrap(Collection)
.appUsers
- collection of ApplicationUser
to mapCheckedUser
ServiceDeskServiceException
- if any of the ApplicationUser
supplied can't be mapped@Nonnull CheckedUser wrapUsername(String username)
username
- the username to be pimped upCheckedUser
with useful stuff attached@Nonnull List<CheckedUser> wrapUsernames(@Nonnull Collection<String> usernames)
usernames
into a JIRA Application User and then wraps them to CheckedUser
.usernames
- the username to be wrapCheckedUser
@Nonnull CheckedUser wrapUserKey(String userkey)
userkey
- find the user by their key, to be pimped up@Nonnull CheckedUser getCheckedUser()
CheckedUser
@Nonnull UncheckedUser getUncheckedUser()
UncheckedUser
@Nonnull List<com.atlassian.jira.user.ApplicationUser> unwrap(@Nonnull Collection<CheckedUser> checkedUsers)
CheckedUser
to a list of ApplicationUser
. Return an error if any CheckedUser
can't be mapped. Reverse of wrap(Collection)
.checkedUsers
- collection of CheckedUser
to mapApplicationUser
ServiceDeskServiceException
- if any CheckedUser
can't be mappedCopyright © 2024 Atlassian. All rights reserved.