Interface CustomField
- All Superinterfaces:
Comparable,ConfigurableField<Object>,DefaultValueField<Object>,Field,HideableField,NavigableField,OrderableField<Object>,RenderableField,RequirableField,RestAwareField,RestFieldOperations,SearchableField
- All Known Implementing Classes:
ImmutableCustomField,MockCustomField
Typically one obtains a CustomField using CustomFieldManager,
eg. CustomFieldManager.getCustomFieldObjectByName(String)
To create or update an instance of a CustomField for an issue use OrderableField.createValue(com.atlassian.jira.issue.Issue, Object)
or OrderableField.updateValue(com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem, com.atlassian.jira.issue.Issue, com.atlassian.jira.issue.ModifiedValue, com.atlassian.jira.issue.util.IssueChangeHolder).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface com.atlassian.jira.issue.fields.NavigableField
ORDER_ASCENDING, ORDER_DESCENDING, TEMPLATE_DIRECTORY_PATHFields inherited from interface com.atlassian.jira.issue.fields.OrderableField
MOVE_ISSUE_PARAM_KEY, NO_HEADER_PARAM_KEY, TEMPLATE_DIRECTORY_PATH -
Method Summary
Modifier and TypeMethodDescriptionintDeprecated, for removal: This API element is subject to removal in a future version.since 10.5.Deprecated.As of 7.2, please usegetAssociatedIssueTypes()Returns a list ofIssueTypes directly associated with thisCustomField.Returns a list ofProjects directly associated with thisCustomField.Return the JQL clause names that this custom field should be recognized by.Returns a list of configuration schemes.Retrieves theCustomFieldSearcherfor this custom field.Looks up theCustomFieldType.getCustomFieldValues(Map customFieldValuesHolder) Get the custom field string values that are relevant to this particular custom fieldReturns the 1i8n'ed description of this custom field.Returns aRenderablePropertyfor rendering this custom field's description.Returns the title of this custom field.org.ofbiz.core.entity.GenericValueDeprecated.UseField.getName(),getDescription(), etc.Returns ID of this custom field.default LongReturns number of issues containing at least one non empty value for the custom field.default TimestampReturns the latest date of either: - creation date of an issue with a non default value of the custom field - issue update date when value of the custom field has been changeddefault OptionsgetOptions(JiraContextNode jiraContextNode) Returns options for this custom field if it is ofMultipleCustomFieldTypetype.default OptionsgetOptions(FieldConfig config) Returns options for this custom field if it is ofMultipleCustomFieldTypetype.getOptions(String key, JiraContextNode jiraContextNode) Deprecated.As of 9.17.0, please usegetOptions(JiraContextNode)insteadgetOptions(String key, FieldConfig config, JiraContextNode contextNode) Deprecated.As of 9.17.0, please usegetOptions(FieldConfig)insteadcom.opensymphony.module.propertyset.PropertySetgetRelevantConfig(IssueContext issueContext) Returns the relevant field config of this custom field for the give issue contextgetRelevantConfig(Issue issue) Returns a relevantFieldConfigfor the given issue.getReleventConfig(SearchContext searchContext) TheFieldConfigthat is relevent to all issue contexts in the search context Checks that all configs within search context are the same - i.e.Returns the description of this custom field by readingENTITY_DESCRIPTIONof the underlying generic value.Returns aRenderablePropertyfor rendering this custom field's untranslated description, for admin.Returns the name of this custom field by readingENTITY_NAMEof the underlying generic value.Retrieves and returns the Object representing the this CustomField value for the given issue.booleanReturns true if it applies for all issue types, false otherwise.booleanChecks whether this custom field applies for all projects.booleanReturns true if this custom field can be edited, false otherwise.booleanReturns true if any configuration scheme returned bygetConfigurationSchemes()is enabled.booleanisGlobal()Returns true if this custom field applies for all projects and all issue types.booleanDetermines if this custom field is within the scope of the given project, and Issue Type.booleanisInScope(SearchContext searchContext) Determines whether this custom field is in scope.booleanDetermines if this custom field is within the scope of the given project, and list of Issue Types.booleanisInScopeForSearch(Project project, List<String> issueTypeIds) Determines if this custom field is within the scope of the given project, and list of Issue Types.booleanisRelevantForIssueContext(IssueContext issueContext) Returns true if the custom field has a config for the Project and Issue Type of the given IssueContext.remove()Deprecated.UseCustomFieldManager.removeCustomField(CustomField)instead.voidvalidateFromActionParams(Map actionParameters, ErrorCollection errorCollection, FieldConfig config) Validates relevant parameters on custom field type of this custom field.Methods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.atlassian.jira.issue.fields.ConfigurableField
getConfigurationItemTypesMethods inherited from interface com.atlassian.jira.issue.fields.DefaultValueField
getDefaultValueOperationsMethods inherited from interface com.atlassian.jira.issue.fields.Field
getId, getName, getNameKeyMethods inherited from interface com.atlassian.jira.issue.fields.NavigableField
getColumnCssClass, getColumnHeadingKey, getColumnViewHtml, getDefaultSortOrder, getFieldSorts, getHiddenFieldId, getSortComparatorSource, getSorter, getSortFields, getValueLoader, hasSortsDefined, prettyPrintChangeHistory, prettyPrintChangeHistory, prettyPrintChangeHistoryMethods inherited from interface com.atlassian.jira.issue.fields.OrderableField
availableForBulkEdit, canRemoveValueFromIssueObject, createValue, getBulkEditHtml, getCreateHtml, getCreateHtml, getDefaultValue, getEditHtml, getEditHtml, getValueFromParams, getViewHtml, getViewHtml, getViewHtml, hasParam, hasValue, isShown, needsMove, populateDefaults, populateForMove, populateFromIssue, populateFromParams, populateParamsFromString, removeValueFromIssueObject, updateIssue, updateValue, validateParamsMethods inherited from interface com.atlassian.jira.issue.fields.renderer.RenderableField
getId, getValueFromIssue, isRenderableMethods inherited from interface com.atlassian.jira.issue.fields.rest.RestAwareField
getFieldTypeInfo, getJsonFromIssue, getJsonSchemaMethods inherited from interface com.atlassian.jira.issue.fields.rest.RestFieldOperations
getJsonDefaultValue, getRestFieldOperationMethods inherited from interface com.atlassian.jira.issue.fields.SearchableField
createAssociatedSearchHandler
-
Field Details
-
ENTITY_CF_TYPE_KEY
- See Also:
-
ENTITY_CUSTOM_FIELD_SEARCHER
- See Also:
-
ENTITY_NAME
- See Also:
-
ENTITY_ISSUETYPE
- See Also:
-
ENTITY_PROJECT
- See Also:
-
ENTITY_ID
- See Also:
-
ENTITY_DESCRIPTION
- See Also:
-
ENTITY_TABLE_NAME
- See Also:
-
ENTITY_LAST_VALUE_UPDATE
- See Also:
-
ENTITY_ISSUES_WITH_VALUE
- See Also:
-
-
Method Details
-
isInScope
Determines if this custom field is within the scope of the given project, and list of Issue Types.- Parameters:
project- The project.issueTypeIds- A list of IssueType ids.- Returns:
trueif this custom field is within the given scope.
-
isInScope
Determines if this custom field is within the scope of the given project, and Issue Type.- Parameters:
projectId- The project.issueTypeId- The issueTypeId- Returns:
trueif this custom field is within the given scope.- See Also:
-
isInScopeForSearch
Determines if this custom field is within the scope of the given project, and list of Issue Types.If the project is null, then it is treated as any project. If the issueTypeIds list is null or an empty list, then it is treated as any issue type.
If the passed project is any project, this method will search in all the
FieldConfigSchemeof this custom field, ignoring the projects that they apply to (since the given project is any) and looking for at least one of them that applies to at least one of the given issue type ids.If the passed list of issue types is any issue type, this method will search for at least one
FieldConfigSchemethat applies to the given project, ignoring the issue types that it applies to (since the given issue type ids are any).If both the project and issue types are any, the question being asked is "is this custom field in the scope of any project and any issue type?", which will always be true.
-
isInScope
Determines whether this custom field is in scope.- Parameters:
searchContext- search context- Returns:
- true if this field is in scope
-
getGenericValue
Deprecated.UseField.getName(),getDescription(), etc. Since v3.0.Returns a generic value that represents this custom field- Returns:
- generic value of this custom field
-
compare
@Deprecated(since="10.5", forRemoval=true) int compare(Issue issue1, Issue issue2) throws IllegalArgumentException Deprecated, for removal: This API element is subject to removal in a future version.since 10.5. To implement advanced issue sorting, a Custom Field should be associated with a CustomFieldSearcher that implementsFieldSortsCustomFieldSearcher.getFieldSorts(CustomField, FieldSort.Order)to return aValueLoaderFieldSortwhich provides the sort comparator.This method compares the values of this custom field in two given issues.Returns a negative integer, zero, or a positive integer as the value of first issue is less than, equal to, or greater than the value of the second issue.
If either of given issues is null a IllegalArgumentException is thrown.
- Parameters:
issue1- issue to compareissue2- issue to compare- Returns:
- a negative integer, zero, or a positive integer as the value of first issue is less than, equal to, or greater than the value of the second issue
- Throws:
IllegalArgumentException- if any of given issues is null
-
getCustomFieldValues
Get the custom field string values that are relevant to this particular custom field- Parameters:
customFieldValuesHolder- containing all params- Returns:
- a
CustomFieldParamsofStringobjects
-
getValue
Retrieves and returns the Object representing the this CustomField value for the given issue. SeeCustomFieldType.getValueFromIssue(CustomField, Issue). This is only used to communicate with the 'view' JSP. Multiselects will return a list, dates a date, etc.- Parameters:
issue- issue to retrieve the value from- Returns:
- Object representing the this CustomField value for the given issue
- See Also:
-
remove
Deprecated.UseCustomFieldManager.removeCustomField(CustomField)instead. Since v7.0.Removes this custom field and returns a set of issue IDs of all issues that are affected by removal of this custom field.- Returns:
- a set of issue IDs of affected issues
- Throws:
DataAccessException- if removal of generic value fails
-
getOptions
Deprecated.As of 9.17.0, please usegetOptions(JiraContextNode)insteadReturns options for this custom field if it is ofMultipleCustomFieldTypetype. Otherwise, returns null.As this is just used by the view layer, it can be a list of objects
- Parameters:
key- not usedjiraContextNode- Jira's context node - used to retrieve the relevant config- Returns:
- options for this custom field if it is of
MultipleCustomFieldTypetype, null otherwise
-
getOptions
Returns options for this custom field if it is ofMultipleCustomFieldTypetype. Otherwise, returns null.As this is just used by the view layer, it can be a list of objects
- Parameters:
jiraContextNode- Jira's context node - used to retrieve the relevant config- Returns:
- options for this custom field if it is of
MultipleCustomFieldTypetype, null otherwise since v9.17.0
-
getDescription
String getDescription()Returns the 1i8n'ed description of this custom field. To render views for the custom field description, prefergetDescriptionProperty().- Returns:
- the description of this custom field
-
getUntranslatedDescription
String getUntranslatedDescription()Returns the description of this custom field by readingENTITY_DESCRIPTIONof the underlying generic value.- Returns:
- the description of this custom field
-
getFieldName
String getFieldName()Returns the title of this custom field.- Returns:
- the title of this custom field
-
getUntranslatedName
String getUntranslatedName()Returns the name of this custom field by readingENTITY_NAMEof the underlying generic value.- Returns:
- the name of this custom field
-
getDescriptionProperty
Returns aRenderablePropertyfor rendering this custom field's description.- Returns:
- a read-only RenderableProperty
- Since:
- v5.0.7
-
getUntranslatedDescriptionProperty
Returns aRenderablePropertyfor rendering this custom field's untranslated description, for admin.- Returns:
- a read-only RenderableProperty
- Since:
- v5.0.7
-
getCustomFieldSearcher
CustomFieldSearcher getCustomFieldSearcher()Retrieves theCustomFieldSearcherfor this custom field. The searcher, if found is initialized with this custom field before it is returned.- Returns:
- found custom field searcher or null, if none found
-
isEditable
boolean isEditable()Returns true if this custom field can be edited, false otherwise.- Returns:
- true if this custom field can be edited, false otherwise
-
getIdAsLong
Long getIdAsLong()Returns ID of this custom field.- Returns:
- ID of this custom field
-
getLastValueUpdate
Returns the latest date of either: - creation date of an issue with a non default value of the custom field - issue update date when value of the custom field has been changed- Returns:
- last update of the custom field
-
getIssuesWithValue
Returns number of issues containing at least one non empty value for the custom field.- Returns:
- number of issues with the non empty custom field
-
getConfigurationSchemes
Returns a list of configuration schemes.- Returns:
- a list of
FieldConfigSchemeobjects.
-
getOptions
Deprecated.As of 9.17.0, please usegetOptions(FieldConfig)insteadReturns options for this custom field if it is ofMultipleCustomFieldTypetype. Otherwise returns null.As this is just used by the view layer, it can be a list of objects
- Parameters:
key- not usedconfig- relevant field configcontextNode- JIRA context node- Returns:
- options for this custom field if it is of
MultipleCustomFieldTypetype, null otherwise
-
getOptions
Returns options for this custom field if it is ofMultipleCustomFieldTypetype. Null otherwise.As this is just used by the view layer, it can be a list of objects
- Parameters:
config- relevant field config- Returns:
- options for this custom field if it is of
MultipleCustomFieldTypetype, null otherwise
-
getRelevantConfig
Returns a relevantFieldConfigfor the given issue. If the field has a config for the issue then one will be returned, otherwise null is returned.For example, if we have 2 projects: project A and project B, and a custom field is configured to be only applicable to project A, calling getRelevantConfig with an issue from project A should return the config (i.e. not null). Calling this method with an issue from project B should return null.
- Parameters:
issue- issue whose project and issue type will be used to check if the field has a config- Returns:
- an instance of
FieldConfigrepresenting the configuration of the field for issue's project/issue type. If the field does not have a config for issue's project/issue type, null is returned. - See Also:
-
validateFromActionParams
void validateFromActionParams(Map actionParameters, ErrorCollection errorCollection, FieldConfig config) Validates relevant parameters on custom field type of this custom field. Any errors found are added to the given errorCollection. SeeCustomFieldType.validateFromParams(CustomFieldParams, ErrorCollection, FieldConfig)- Parameters:
actionParameters- action parameterserrorCollection- error collection to add errors toconfig- field config
-
getAssociatedProjectObjects
Returns a list ofProjects directly associated with thisCustomField.This method can return an empty result when the
CustomFieldis associated with allProjects. Please useisAllProjects()prior to this method to detect this."- Specified by:
getAssociatedProjectObjectsin interfaceConfigurableField<Object>- Returns:
- a list of
Projects directly associated with thisCustomField.
-
getAssociatedIssueTypes
Returns a list ofIssueTypes directly associated with thisCustomField.In case when this
CustomFieldisAllIssueTypes()it will be associated with allIssueTypes but this method can still return empty result.- Returns:
- a list of
IssueTypes directly associated with thisCustomField.
-
getAssociatedIssueTypeObjects
Deprecated.As of 7.2, please usegetAssociatedIssueTypes()- See Also:
-
isGlobal
boolean isGlobal()Returns true if this custom field applies for all projects and all issue types.- Returns:
- true if it is in all projects and all issue types, false otherwise.
-
isAllProjects
boolean isAllProjects()Checks whether this custom field applies for all projects. It returns true if it applies for all projects for any field configuration scheme, false otherwise.- Returns:
- true if it applies for all projects for any field configuration scheme, false otherwise.
-
isAllIssueTypes
boolean isAllIssueTypes()Returns true if it applies for all issue types, false otherwise.- Returns:
- true if it applies for all issue types, false otherwise.
-
isEnabled
boolean isEnabled()Returns true if any configuration scheme returned bygetConfigurationSchemes()is enabled.- Returns:
- true if any configuration scheme is enabled, false otherwise
-
getCustomFieldType
CustomFieldType getCustomFieldType()Looks up theCustomFieldType. It can return null if the custom field type cannot be found in theCustomFieldManager.- Returns:
- custom field type
-
isRelevantForIssueContext
Returns true if the custom field has a config for the Project and Issue Type of the given IssueContext.This is equivalent to calling
getRelevantConfig(issueContext) != null
but in general can run faster because it does not have to resolve the actual FieldConfig.- Parameters:
issueContext- IssueContext whose project and issue type will be used to check if the field has a config- Returns:
- an instance of
FieldConfigrepresenting the configuration of the field for issue's project/issue type. If the field does not have a config for issue's project/issue type, null is returned. - See Also:
-
getRelevantConfig
Returns the relevant field config of this custom field for the give issue context- Specified by:
getRelevantConfigin interfaceConfigurableField<Object>- Parameters:
issueContext- issue context to find the relevant field config for- Returns:
- the relevant field config of this custom field for the give issue context
- See Also:
-
getReleventConfig
TheFieldConfigthat is relevent to all issue contexts in the search context Checks that all configs within search context are the same - i.e. all null or all the same config.Returns null if any two configs are different.
Note: null config is not equal to non-null config. Previously, a non-null config was returned even if the first config(s) was null.
- Parameters:
searchContext- search context- Returns:
- null if any two configs are different
-
getClauseNames
ClauseNames getClauseNames()Return the JQL clause names that this custom field should be recognized by.- Returns:
- the clause names this custom field should be recognized by.
-
getPropertySet
com.opensymphony.module.propertyset.PropertySet getPropertySet()
-