|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.almworks.jira.structure.util.StructureUtil
public class StructureUtil
Contains miscellaneous utility methods.
| Field Summary | |
|---|---|
static long |
GLOBAL_STRUCTURE_ID
|
static La<com.almworks.integers.IntIterator,Integer> |
INT_ITERATOR_TO_INT
|
static La<com.almworks.integers.LongIterator,Long> |
LONG_ITERATOR_TO_LONG
|
static int |
MAX_PROPERTY_LENGTH
|
static La<String,Long> |
STRING_LONG
|
| Constructor Summary | |
|---|---|
StructureUtil()
|
|
| Method Summary | |
|---|---|
static StringBuilder |
appendDebugStructureString(StringBuilder sb,
long structureId,
StructureManager manager)
|
static PermissionLevel |
applyPermissions(List<PermissionRule> permissions,
com.atlassian.crowd.embedded.api.User user,
List<Object> stack,
La<Long,List<PermissionRule>> resolver,
PermissionLevel pass)
|
static List<PermissionRule> |
copyPermissions(Collection<? extends PermissionRule> permissions)
|
static List<PermissionRule> |
copyPermissionsOrNull(Collection<? extends PermissionRule> permissions)
|
static JAXBContext |
createJAXBContext(Class contextClass)
|
static String |
debugAction(com.opensymphony.workflow.loader.ActionDescriptor action)
|
static String |
debugConstant(com.atlassian.jira.issue.IssueConstant constant)
|
static String |
getDebugIssueKey(long issueId)
Returns issue key if possible. |
static String |
getDebugIssueString(com.atlassian.jira.issue.Issue issue)
Returns a string representation of the issue that is used to write log messages. |
static String |
getDebugIssueString(Long issue)
Returns a string representation of the issue that is used to write log messages. |
static String |
getDebugStructureString(long structureId,
StructureManager manager)
|
static Locale |
getJiraDefaultLocale()
|
static String |
getLongProperty(com.atlassian.jira.config.properties.ApplicationProperties properties,
String name)
Reads a value previously stored in properties using setLongValue |
static List<String> |
getMultiParameter(Map map,
String name)
|
static List<Long> |
getMultiParameterLong(Map map,
String name)
|
static String |
getSingleParameter(Map map,
String name)
|
static boolean |
getSingleParameterBoolean(Map map,
String name)
|
static Integer |
getSingleParameterInteger(Map map,
String name)
|
static Long |
getSingleParameterLong(Map map,
String name)
|
static String |
getText(Locale locale,
com.atlassian.crowd.embedded.api.User user,
String textKey,
Object... messageParameters)
Formats the text taken from the i18n bundle with the specified parameters in the locale that is selected as follows: If locale is not null, it is used. |
static String |
getTextInCurrentUserLocale(String key,
Object... parameters)
|
static com.atlassian.crowd.embedded.api.User |
getUserByKey(String userKey)
|
static com.atlassian.crowd.embedded.api.User |
getUserByName(String userName)
|
static String |
getUserKey(com.atlassian.crowd.embedded.api.User user)
|
static String |
getUserNameByKey(String userKey)
|
static String |
issueKeyOrId(com.atlassian.jira.issue.Issue issue,
Long issueId)
|
static long |
lastOrZero(com.almworks.integers.LongList list)
Returns the last element of the given list if it's not empty, 0 otherwise. |
static boolean |
listsEqual(com.almworks.integers.LongList list1,
com.almworks.integers.LongList list2)
Tests whether the given lists are equal (contain the same numbers in the same order). |
static String |
migrateUserNameToUserKey(String userName)
|
static void |
setLongProperty(com.atlassian.jira.config.properties.ApplicationProperties properties,
String name,
String value)
Sets a possibly long value (template) as an application property. |
static String |
username(com.atlassian.crowd.embedded.api.User user)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long GLOBAL_STRUCTURE_ID
public static final int MAX_PROPERTY_LENGTH
public static final La<String,Long> STRING_LONG
public static final La<com.almworks.integers.IntIterator,Integer> INT_ITERATOR_TO_INT
public static final La<com.almworks.integers.LongIterator,Long> LONG_ITERATOR_TO_LONG
| Constructor Detail |
|---|
public StructureUtil()
| Method Detail |
|---|
public static PermissionLevel applyPermissions(List<PermissionRule> permissions,
com.atlassian.crowd.embedded.api.User user,
List<Object> stack,
La<Long,List<PermissionRule>> resolver,
PermissionLevel pass)
public static JAXBContext createJAXBContext(Class contextClass)
public static Long getSingleParameterLong(Map map,
String name)
public static Integer getSingleParameterInteger(Map map,
String name)
public static boolean getSingleParameterBoolean(Map map,
String name)
public static String getSingleParameter(Map map,
String name)
@NotNull
public static List<String> getMultiParameter(Map map,
String name)
public static List<Long> getMultiParameterLong(Map map,
String name)
public static void setLongProperty(com.atlassian.jira.config.properties.ApplicationProperties properties,
String name,
String value)
properties - properties interfacename - the name of the propertyvalue - the value
public static String getLongProperty(com.atlassian.jira.config.properties.ApplicationProperties properties,
String name)
properties - application propetiesname - the name of the property to read
public static long lastOrZero(com.almworks.integers.LongList list)
list - the list of longs
list or 0 if it's empty.
public static boolean listsEqual(com.almworks.integers.LongList list1,
com.almworks.integers.LongList list2)
null list.
list1 - the first listlist2 - the second list
true if the lists are equal, false otherwise.
@Nullable
public static List<PermissionRule> copyPermissionsOrNull(@Nullable
Collection<? extends PermissionRule> permissions)
@NotNull
public static List<PermissionRule> copyPermissions(@Nullable
Collection<? extends PermissionRule> permissions)
@NotNull
public static String getDebugIssueString(@Nullable
Long issue)
issue - the ID of the issue
@Nullable public static String getDebugIssueKey(long issueId)
@NotNull
public static String getDebugIssueString(@Nullable
com.atlassian.jira.issue.Issue issue)
issue - the issue
public static String issueKeyOrId(@Nullable
com.atlassian.jira.issue.Issue issue,
@Nullable
Long issueId)
null. Otherwise, if issue ID is not null, returns issue ID in the form "issue #123". Otherwise,
returns string "(no issue ID)".
Better suited for high-level log messages than getDebugIssueString(java.lang.Long) in that it is easily recognizable as issue representation to JIRA admin.
@NotNull
public static StringBuilder appendDebugStructureString(StringBuilder sb,
long structureId,
StructureManager manager)
@NotNull
public static String getDebugStructureString(long structureId,
StructureManager manager)
@NotNull
public static String username(@Nullable
com.atlassian.crowd.embedded.api.User user)
public static String debugConstant(com.atlassian.jira.issue.IssueConstant constant)
public static String debugAction(com.opensymphony.workflow.loader.ActionDescriptor action)
public static String getTextInCurrentUserLocale(String key,
Object... parameters)
public static String getText(@Nullable
Locale locale,
@Nullable
com.atlassian.crowd.embedded.api.User user,
String textKey,
Object... messageParameters)
root (neutral) locale is used.
messageParameters - can be the same as I18nHelper.getText(String, Object)public static Locale getJiraDefaultLocale()
@Nullable
public static String getUserKey(@Nullable
com.atlassian.crowd.embedded.api.User user)
@Nullable
public static com.atlassian.crowd.embedded.api.User getUserByKey(@Nullable
String userKey)
@Nullable
public static com.atlassian.crowd.embedded.api.User getUserByName(@Nullable
String userName)
@Nullable
public static String getUserNameByKey(@Nullable
String userKey)
@Nullable
public static String migrateUserNameToUserKey(@Nullable
String userName)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||