@ParametersAreNullableByDefault public interface UserFactory
SDUser
and JIRA ApplicationUser
classes.
For most APIs in Service Desk 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 |
---|---|
com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,CheckedUser> |
getCheckedUser()
Helper method to wrap getCurrentUserByType[CheckedUser].
|
UncheckedUser |
getUncheckedUser()
Helper method to wrap getCurrentUserByType[UncheckedUser].
|
com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,List<com.atlassian.jira.user.ApplicationUser>> |
unwrap(Collection<CheckedUser> checkedUsers)
Map a list of
CheckedUser to a list of ApplicationUser . |
com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,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 . |
com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,List<CheckedUser>> |
wrap(Collection<com.atlassian.jira.user.ApplicationUser> appUsers)
Map a list of
ApplicationUser to a list of CheckedUser . |
com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,UncheckedUser> |
wrapUnchecked(com.atlassian.jira.user.ApplicationUser appUser)
Returns a
UncheckedUser from the application user. |
com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,CheckedUser> |
wrapUserKey(String userkey)
This turns a user key into a JIRA Application User and then wraps it up.
|
com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,CheckedUser> |
wrapUsername(String username)
This turns a username into a JIRA Application User and then wraps it up.
|
com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,List<CheckedUser>> |
wrapUsernames(Collection<String> usernames)
This turns
usernames into a JIRA Application User and then wraps them to CheckedUser . |
@Nonnull com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,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 user@Nonnull com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,UncheckedUser> wrapUnchecked(com.atlassian.jira.user.ApplicationUser appUser)
UncheckedUser
from the application user.appUser
- the application user@Nonnull com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,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
or an error if any ApplicationUser
can't be mapped@Nonnull com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,CheckedUser> wrapUsername(String username)
username
- the username to be pimped upCheckedUser
with useful stuff attached@Nonnull com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,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 com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,CheckedUser> wrapUserKey(String userkey)
userkey
- find the user by their key, to be pimped up@Nonnull com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,CheckedUser> getCheckedUser()
@Nonnull UncheckedUser getUncheckedUser()
@Nonnull com.atlassian.fugue.Either<com.atlassian.pocketknife.api.commons.error.AnError,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
or an error if any CheckedUser
can't be mappedCopyright © 2017 Atlassian. All rights reserved.