public class CustomFieldUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CUSTOM_FIELD_PREFIX |
static String |
PARAM_REQUIRE_PROJECT_IDS
Deprecated.
since v6.2.3 use
getParamKeyRequireProjectIds() instead. |
Constructor and Description |
---|
CustomFieldUtils() |
Modifier and Type | Method and Description |
---|---|
static List<IssueType> |
buildIssueTypes(ConstantsManager constantsManager,
String[] issueTypes) |
static List<JiraContextNode> |
buildJiraIssueContexts(boolean global,
Long[] projectCategories,
Long[] projects,
JiraContextTreeManager treeManager)
Deprecated.
Use
buildJiraIssueContexts(boolean, Long[], com.atlassian.jira.project.ProjectManager) instead. Since v6.4. |
static List<JiraContextNode> |
buildJiraIssueContexts(boolean global,
Long[] projects,
ProjectManager projectManager) |
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(Project project,
List<String> issueTypeIds)
Converts list of issue type ids to
IssueContexts . |
static String |
createSearchParam(String customFieldId,
String searchParam) |
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 |
getParamKeyIssueId()
Name of the parameter that stores the issue id in the current context in CustomFieldParams.
|
static String |
getParamKeyPrefixAtl()
The prefix to be used by Atlassian defined custom field parameter names, so that we could avoid naming conflict
between Atlassian parameters and parameters used by third party plugin.
|
static String |
getParamKeyProjectId()
Name of the parameter that stores the project id of the associated issue in the current context in
CustomFieldParams.
|
static String |
getParamKeyRequireProjectIds()
Name of the parameter that indicates whether the list of project id's associated with the current context
should be loaded, either from the current issue (when editing value of an issue) or
from FieldConfig and its FieldConfigScheme (when setting default value).
|
static Collection<Long> |
getProjectIdsForUser(ApplicationUser user,
Collection<Long> projectIds,
PermissionManager permissionManager,
UserFilter userFilter)
If
projectIds is not empty, return it. |
static Collection<Long> |
getProjectIdsFromIssueOrFieldConfig(Issue issue,
FieldConfig config,
FieldConfigSchemeManager fieldConfigSchemeManager,
ProjectManager projectManager)
Retrieve the list of project id's from issue or field config, in the following order:
If
issue is not null and issue.getProjectId() is not null, return a single list with issue.getProjectId()
If config is not null, use it to retrieve the list of project id's associated with the current scheme
Otherwise, return null
|
static Collection<Long> |
getProjectIdsFromProjectOrFieldConfig(Long projectIdFromIssue,
FieldConfig config,
FieldConfigSchemeManager fieldConfigSchemeManager,
ProjectManager projectManager)
Retrieve the list of project id's from issue or field config, in the following order:
If
issue is not null and issue.getProjectId() is not null, return a single list with issue.getProjectId()
If config is not null, use it to retrieve the list of project id's associated with the current scheme
Otherwise, return null
|
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,
ApplicationUser 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 com.atlassian.jira.web.FieldVisibilityManager#isFieldHiddenInAllSchemes(String, SearchContext, User) ) |
static boolean |
isUserHasPermissionToProjects(CustomField customField,
ApplicationUser 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
|
static String |
prettyPrintOptions(Options options) |
public static final String CUSTOM_FIELD_PREFIX
@Deprecated public static final String PARAM_REQUIRE_PROJECT_IDS
getParamKeyRequireProjectIds()
instead.#getParamKeyRequireProjectIds()}
,
Constant Field Valuespublic static String getParamKeyPrefixAtl()
public static String getParamKeyRequireProjectIds()
This parameter could be used in two places now:
CustomFieldType.getVelocityParameters(com.atlassian.jira.issue.Issue, com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem)
to inform buildParams(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.fields.config.FieldConfig, com.atlassian.jira.issue.Issue, com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem, Object, java.util.Map, webwork.action.Action, java.util.Map)
that project id's need to be loadedCustomFieldParams
to inform CustomFieldType.validateFromParams(com.atlassian.jira.issue.customfields.view.CustomFieldParams, com.atlassian.jira.util.ErrorCollection, com.atlassian.jira.issue.fields.config.FieldConfig)
that project id's need to be loaded from field config scheme.public static String getParamKeyIssueId()
public static String getParamKeyProjectId()
public static Long getCustomFieldId(String key)
key
- eg. "customfield_10000"public static boolean isCollectionNotEmpty(Collection stringCollection)
public static Map<CustomField,Object> parseCustomFieldValuesFromActionParams(Map actionParameters, List<CustomField> customFields)
actionParameters
- map of action parameterscustomFields
- a list of custom fieldspublic static List<JiraContextNode> buildJiraIssueContexts(boolean global, Long[] projects, ProjectManager projectManager)
public static List<JiraContextNode> buildJiraIssueContexts(boolean global, Long[] projectCategories, Long[] projects, JiraContextTreeManager treeManager)
buildJiraIssueContexts(boolean, Long[], com.atlassian.jira.project.ProjectManager)
instead. Since v6.4.public static List<IssueType> buildIssueTypes(ConstantsManager constantsManager, String[] issueTypes)
public static List<IssueContext> convertToIssueContexts(Project project, List<String> issueTypeIds)
IssueContexts
.project
- The project (may be null).issueTypeIds
- Type ids as strings, eg. ["3", "4"]. May be null or empty.public static boolean isUserHasPermissionToProjects(CustomField customField, ApplicationUser user)
customField
- custom fielduser
- userpublic static Map<String,Object> buildParams(CustomField customField, FieldConfig config, Issue issue, FieldLayoutItem fieldLayoutItem, Object value, Map customFieldValuesHolder, webwork.action.Action action, Map displayParameters)
public static String getDateFormat()
DateTimeFormatUtils.getDateFormat()
instead. Since v5.0.ie the format stored in the "jira.date.picker.javascript.format" application property.
public static String getDateTimeFormat()
DateTimeFormatUtils.getDateTimeFormat()
instead. Since v5.0.ie the format stored in the "jira.date.time.picker.javascript.format" application property.
public static String getTimeFormat()
DateTimeFormatUtils.getTimeFormat()
instead. Since v5.0.protected static I18nHelper getI18nBean()
public static boolean isShownAndVisible(CustomField customField, ApplicationUser user, SearchContext searchContext, FieldVisibilityManager fieldVisibilityManager)
OrderableField.isShown(com.atlassian.jira.issue.Issue)
)
and visible in all field schemes (using com.atlassian.jira.web.FieldVisibilityManager#isFieldHiddenInAllSchemes(String, SearchContext, User)
)customField
- customfield to check visibility ofuser
- current usersearchContext
- search contextfieldVisibilityManager
- field visibility beanOrderableField.isShown(com.atlassian.jira.issue.Issue)
,
com.atlassian.jira.web.FieldVisibilityManager#isFieldHiddenInAllSchemes(String, com.atlassian.jira.issue.search.SearchContext, User)
public static Collection<Long> getProjectIdsFromIssueOrFieldConfig(Issue issue, FieldConfig config, FieldConfigSchemeManager fieldConfigSchemeManager, ProjectManager projectManager)
issue
is not null and issue.getProjectId() is not null, return a single list with issue.getProjectId()config
is not null, use it to retrieve the list of project id's associated with the current schemepublic static Collection<Long> getProjectIdsFromProjectOrFieldConfig(Long projectIdFromIssue, FieldConfig config, FieldConfigSchemeManager fieldConfigSchemeManager, ProjectManager projectManager)
issue
is not null and issue.getProjectId() is not null, return a single list with issue.getProjectId()config
is not null, use it to retrieve the list of project id's associated with the current schemepublic static Collection<Long> getProjectIdsForUser(ApplicationUser user, Collection<Long> projectIds, PermissionManager permissionManager, UserFilter userFilter)
projectIds
is not empty, return it.
Otherwise, return the list of project id's that the user
could browse.
If projectIds
is not provided and userFilter
contains no roleIds, the list of browsable project
ids will not be computed. An empty list will be returned instead.
Copyright © 2002-2018 Atlassian. All Rights Reserved.