|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.atlassian.jira.usercompatibility.UserCompatibilityHelper
public class UserCompatibilityHelper
Helper class containing utility methods for plugins which supports both JIRA 6.0 and older.
In this case, cannot use directly a new ApplicationUser interface introduced in JIRA 6.0. This class contains
methods which can be used to perform type-safe operations.
| Constructor Summary | |
|---|---|
UserCompatibilityHelper()
|
|
| Method Summary | |
|---|---|
static UserWithKey |
convertUserObject(java.lang.Object userObject)
Converts given userObject into UserWithKey. |
static java.lang.String |
getKeyForUser(com.atlassian.crowd.embedded.api.User user)
Returns unique key, which e.g. |
static com.atlassian.crowd.embedded.api.User |
getUserForKey(java.lang.String key)
Returns User object based on specified key. |
static boolean |
isUserObject(java.lang.Object object)
Tells whether given object represents a user and can be passed to convertUserObject(Object). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UserCompatibilityHelper()
| Method Detail |
|---|
public static UserWithKey convertUserObject(java.lang.Object userObject)
UserWithKey.
This method was introduced as an answer for different return value from com.atlassian.jira.issue.fields.CustomFields containing users in JIRA 6.0. In such case, com.atlassian.jira.issue.fields.CustomField returns User in JIRA < 6.0, and ApplicationUser in
JIRA >= 6.0
userObject - object representing User
UserWithKey object containg unique user's key and User object itself.
java.lang.IllegalArgumentException - when given userObject has unknown type
ApplicationUserUtilAccessException - when necessary class/method cannot be accessedpublic static java.lang.String getKeyForUser(com.atlassian.crowd.embedded.api.User user)
User.
For plugin which supports only JIRA >= 6.0 it is highly recommended to use com.atlassian.jira.user.ApplicationUsers#getKeyFor(com.atlassian.crowd.embedded.api.User) directly
user - the directory User
ApplicationUserUtilAccessException - when necessary class/method cannot be accessedpublic static com.atlassian.crowd.embedded.api.User getUserForKey(java.lang.String key)
User object based on specified key.
This method should be used as an opposite of UserCompabilityHelper#getKeyForUser(com.atlassian.crowd.embedded.api.User)
for finding users based on string, e.g. stored in persistent storage. For plugin which supports only JIRA
>= 6.0 it is highly recommended to use UserManager#getUserByKey(String) directly.
Warning: Principal.getName() of returned user can be not equal
to given key.
key - User's key
User object for given key
ApplicationUserUtilAccessException - when necessary class/method cannot be accessedpublic static boolean isUserObject(java.lang.Object object)
convertUserObject(Object).
This method was introduced as an answer for different return value from com.atlassian.jira.issue.fields.CustomFields containing users in JIRA 6.0. In such case, com.atlassian.jira.issue.fields.CustomField returns User in JIRA < 6.0, and ApplicationUser in
JIRA >= 6.0
object - object possibly representing a User
convertUserObject(Object).
ApplicationUserUtilAccessException - when necessary class/method cannot be accessed
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||