com.atlassian.jira.issue.customfields
Class CustomFieldUtils

java.lang.Object
  extended by com.atlassian.jira.issue.customfields.CustomFieldUtils

public class CustomFieldUtils
extends Object


Field Summary
static String CUSTOM_FIELD_PREFIX
           
 
Constructor Summary
CustomFieldUtils()
           
 
Method Summary
static List<org.ofbiz.core.entity.GenericValue> buildIssueTypes(ConstantsManager constantsManager, String[] issueTypes)
           
static List<JiraContextNode> buildJiraIssueContexts(boolean global, Long[] projectCategories, Long[] projects, JiraContextTreeManager treeManager)
           
static Map<String,Object> buildParams(CustomField customField, FieldConfig config, Issue issue, FieldLayoutItem fieldLayoutItem, Object value, Map customFieldValuesHolder, webwork.action.Action action, Map displayParameters)
           
static List<IssueContext> convertToIssueContexts(org.ofbiz.core.entity.GenericValue project, List<String> issueTypeIds)
          Deprecated. Please use convertToIssueContexts(Project, List). Since v4.0
static List<IssueContext> convertToIssueContexts(Project project, List<String> issueTypeIds)
          Converts list of issue type ids to IssueContexts.
static Long getCustomFieldId(String key)
          Given a custom field key, return its id or null.
static String getCustomFieldKey(String searchParamKey)
           
static String getDateFormat()
          Deprecated. Use DateTimeFormatUtils.getDateFormat() instead. Since v5.0.
static String getDateTimeFormat()
          Deprecated. Use DateTimeFormatUtils.getDateTimeFormat() instead. Since v5.0.
protected static I18nHelper getI18nBean()
           
static String getSearchParamSuffix(String searchParamKey)
           
static String getTimeFormat()
          Deprecated. Use DateTimeFormatUtils.getTimeFormat() instead. Since v5.0.
static boolean isCollectionNotEmpty(Collection stringCollection)
           
static boolean isShownAndVisible(CustomField customField, com.atlassian.crowd.embedded.api.User user, SearchContext searchContext, FieldVisibilityManager fieldVisibilityManager)
          Checks if the custom field is in the search context scope (using OrderableField.isShown(com.atlassian.jira.issue.Issue)) and visible in all field schemes (using FieldVisibilityManager.isFieldHiddenInAllSchemes(String,SearchContext,User))
static boolean isUserHasPermissionToProjects(CustomField customField, com.atlassian.crowd.embedded.api.User user)
          Does the user have permission to at least one project that falls under this custom field.
static Map<CustomField,Object> parseCustomFieldValuesFromActionParams(Map actionParameters, List<CustomField> customFields)
          Parses action parameters (Map of Collections of Strings with [:]> as key)
static String prettyPrintOptions(Options options)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CUSTOM_FIELD_PREFIX

public static final String CUSTOM_FIELD_PREFIX
See Also:
Constant Field Values
Constructor Detail

CustomFieldUtils

public CustomFieldUtils()
Method Detail

getSearchParamSuffix

public static String getSearchParamSuffix(String searchParamKey)

getCustomFieldKey

public static String getCustomFieldKey(String searchParamKey)

getCustomFieldId

public static Long getCustomFieldId(String key)
Given a custom field key, return its id or null.

Parameters:
key - eg. "customfield_10000"
Returns:
Id, eg. 10000

isCollectionNotEmpty

public static boolean isCollectionNotEmpty(Collection stringCollection)

parseCustomFieldValuesFromActionParams

public static Map<CustomField,Object> parseCustomFieldValuesFromActionParams(Map actionParameters,
                                                                             List<CustomField> customFields)
Parses action parameters (Map of Collections of Strings with [:]> as key)

Parameters:
actionParameters - map of action parameters
customFields - a list of custom fields
Returns:
a map of custom field to its value, never null
Since:
3.1-DEV

buildJiraIssueContexts

public static List<JiraContextNode> buildJiraIssueContexts(boolean global,
                                                           Long[] projectCategories,
                                                           Long[] projects,
                                                           JiraContextTreeManager treeManager)

buildIssueTypes

public static List<org.ofbiz.core.entity.GenericValue> buildIssueTypes(ConstantsManager constantsManager,
                                                                       String[] issueTypes)

convertToIssueContexts

public static List<IssueContext> convertToIssueContexts(org.ofbiz.core.entity.GenericValue project,
                                                        List<String> issueTypeIds)
Deprecated. Please use convertToIssueContexts(Project, List). Since v4.0

Converts list of issue type ids to IssueContexts.

Parameters:
project - project generic value
issueTypeIds - Type ids as strings, eg. ["3", "4"]
Returns:
a list of issue contexts, never null

convertToIssueContexts

public static List<IssueContext> convertToIssueContexts(Project project,
                                                        List<String> issueTypeIds)
Converts list of issue type ids to IssueContexts.

Parameters:
project - The project (may be null).
issueTypeIds - Type ids as strings, eg. ["3", "4"]. May be null or empty.
Returns:
a list of issue contexts, never null

isUserHasPermissionToProjects

public static boolean isUserHasPermissionToProjects(CustomField customField,
                                                    com.atlassian.crowd.embedded.api.User user)
Does the user have permission to at least one project that falls under this custom field. If the custom field has not been configured for anything, it won't return true either

Parameters:
customField - custom field
user - user
Returns:
true if user has permission to at least one project that falls under this custom field, false otherwise

prettyPrintOptions

public static String prettyPrintOptions(Options options)

buildParams

public static Map<String,Object> buildParams(CustomField customField,
                                             FieldConfig config,
                                             Issue issue,
                                             FieldLayoutItem fieldLayoutItem,
                                             Object value,
                                             Map customFieldValuesHolder,
                                             webwork.action.Action action,
                                             Map displayParameters)

getDateFormat

public static String getDateFormat()
Deprecated. Use DateTimeFormatUtils.getDateFormat() instead. Since v5.0.

Returns the configured Javascript date picker format.

ie the format stored in the "jira.date.picker.javascript.format" application property.

Returns:
the configured Javascript date picker format.

getDateTimeFormat

public static String getDateTimeFormat()
Deprecated. Use DateTimeFormatUtils.getDateTimeFormat() instead. Since v5.0.

Returns the configured Javascript date-time picker format.

ie the format stored in the "jira.date.time.picker.javascript.format" application property.

Returns:
the configured Javascript date-time picker format.

getTimeFormat

public static String getTimeFormat()
Deprecated. Use DateTimeFormatUtils.getTimeFormat() instead. Since v5.0.

Returns "12" or "24" from the Javascript date-time picker format.

Returns:
"12" or "24" from the Javascript date-time picker format.

getI18nBean

protected static I18nHelper getI18nBean()

isShownAndVisible

public static boolean isShownAndVisible(CustomField customField,
                                        com.atlassian.crowd.embedded.api.User user,
                                        SearchContext searchContext,
                                        FieldVisibilityManager fieldVisibilityManager)
Checks if the custom field is in the search context scope (using OrderableField.isShown(com.atlassian.jira.issue.Issue)) and visible in all field schemes (using FieldVisibilityManager.isFieldHiddenInAllSchemes(String,SearchContext,User))

Parameters:
customField - customfield to check visibility of
user - current user
searchContext - search context
fieldVisibilityManager - field visibility bean
Returns:
true if the customfield is in scope and visibile in all schemes in the specified search context
See Also:
OrderableField.isShown(com.atlassian.jira.issue.Issue), FieldVisibilityManager.isFieldHiddenInAllSchemes(String,com.atlassian.jira.issue.search.SearchContext,User)


Copyright © 2002-2014 Atlassian. All Rights Reserved.