public class

CustomFieldImpl

extends Object
implements CustomField
java.lang.Object
   ↳ com.atlassian.jira.issue.fields.CustomFieldImpl
Known Direct Subclasses

Class Overview

Default CustomField implementation backed by the database (a GenericValue object). Usually managed via CustomFieldManager.

Summary

[Expand]
Inherited Constants
From interface com.atlassian.jira.issue.fields.CustomField
From interface com.atlassian.jira.issue.fields.NavigableField
From interface com.atlassian.jira.issue.fields.OrderableField
Public Methods
String availableForBulkEdit(BulkEditBean bulkEditBean)
Checks if custom field is available for bulk edit operation, whether 'shown' and if user has bulk update permission.
boolean canRemoveValueFromIssueObject(Issue issue)
Returns true if a call to removeValueFromIssueObject(com.atlassian.jira.issue.MutableIssue) will actually remove the value.
int compare(Issue issue1, Issue issue2)
This method compares the values of this custom field in two given issues.
int compareTo(Object o)
SearchHandler createAssociatedSearchHandler()
Return SearchHandler for the field.
void createValue(Issue issue, Object value)
boolean equals(Object o)
List<IssueType> getAssociatedIssueTypeObjects()
Returns a list of issue types associated with this custom field.
List<IssueType> getAssociatedIssueTypes()
Returns a list of issue types associated with this custom field.
List<Project> getAssociatedProjectObjects()
Returns a list of projects associated with this custom field.
String getBulkEditHtml(OperationContext operationContext, Action action, BulkEditBean bulkEditBean, Map displayParameters)
Returns HTML that should be shown when the issue is being bulk edited.
ClauseNames getClauseNames()
Return the JQL clause names that this custom field should be recognized by.
String getColumnCssClass()
String getColumnHeadingKey()
String getColumnViewHtml(FieldLayoutItem fieldLayoutItem, Map displayParams, Issue issue)
List getConfigurationItemTypes()
Returns a List of FieldConfigItemType objects.
List<FieldConfigScheme> getConfigurationSchemes()
Returns a list of configuration schemes.
String getCreateHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue, Map dispayParameters)
Returns the HTML that should be shown when the issue is being created.
String getCreateHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue)
Returns the HTML that should be shown when the issue is being created.
CustomFieldSearcher getCustomFieldSearcher()
Retrieves the CustomFieldSearcher for this custom field looking it up in the customFieldManager by the searcher key retrieved from ENTITY_CUSTOM_FIELD_SEARCHER underlying generic value attribute.
CustomFieldType getCustomFieldType()
Looks up the CustomFieldType in the #customFieldTypeModuleDescriptors by the key retrieved from the ENTITY_CF_TYPE_KEY attribute of the underlying generic value.
CustomFieldParams getCustomFieldValues(Map customFieldValuesHolder)
Get the custom field string values that are relevant to this particular custom field
String getDefaultSortOrder()
Object getDefaultValue(Issue issue)
The value that should be set on the issue if the field is not shown for some reason.
String getDescription()
Returns the i18n'ed description of this custom field.
@Nonnull RenderableProperty getDescriptionProperty()
Returns a RenderableProperty for rendering this custom field's description.
String getEditHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue, Map dispayParameters)
Returns HTML that should be shown when the issue is being edited.
String getEditHtml(FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue)
Returns HTML that should be shown when the issue is being edited.
String getFieldName()
Returns the title of this custom field.
FieldTypeInfo getFieldTypeInfo(FieldTypeInfoContext fieldTypeInfoContext)
Returns lower level Information about the field.
GenericValue getGenericValue()
Returns a generic value that represents this custom field.
String getHiddenFieldId()
Returns the id of the field to check for visibility.
String getId()
Returns the identifier for this RenderableField.
Long getIdAsLong()
Returns ID of this custom field.
JsonData getJsonDefaultValue(IssueContext issueCtx)
Return The default data for this system field.
FieldJsonRepresentation getJsonFromIssue(Issue issue, boolean renderedVersionRequested, FieldLayoutItem fieldLayoutItem)
Return a FieldJsonDataPair containing a json representation of the raw data for this field, and if required, a json representation of the rendered data for easy display.
JsonType getJsonSchema()
Return a description of the shape of this field when represented as JSON.
String getName()
Returns the name of this custom field.
String getNameKey()
The i18n key that is used to lookup the field's name when it is displayed
Options getOptions(String key, FieldConfig config, JiraContextNode contextNode)
Returns options for this custom field if it is of MultipleCustomFieldType type.
Options getOptions(String key, JiraContextNode jiraContextNode)
Returns options for this custom field if it is of MultipleCustomFieldType type.
static String getParamKeyIssueId()
Name of the parameter that stores the issue id in the current context in CustomFieldParams.
static String getParamKeyProjectId()
Name of the parameter that stores the project id of the associated issue in the current context in CustomFieldParams.
PropertySet getPropertySet()
FieldConfig getRelevantConfig(Issue issue)
Returns a relevant FieldConfig for the given issue.
FieldConfig getRelevantConfig(IssueContext issueContext)
Returns the relevant field config of this custom field for the give issue context
FieldConfig getReleventConfig(SearchContext searchContext)
Return the relevant field config for the search context specified.
RestFieldOperationsHandler getRestFieldOperation()
FieldComparatorSource getSortComparatorSource()
Return a SortComparatorSource that uses either a custom field searcher that implements SortableCustomFieldSearcher or a custom field that implements SortableCustomField.
List<SortField> getSortFields(boolean sortOrder)
Return a list of Lucene SortFields to be used for sorting search results.
LuceneFieldSorter getSorter()
If this field has a searcher, and this searcher implements SortableCustomFieldSearcher then return getSorter(CustomField).
String getUntranslatedDescription()
Returns the description of this custom field by reading ENTITY_DESCRIPTION of the underlying generic value.
@Nonnull RenderableProperty getUntranslatedDescriptionProperty()
Returns a RenderableProperty for rendering this custom field's description.
String getUntranslatedName()
Returns the name of this custom field by reading ENTITY_NAME of the underlying generic value.
Object getValue(Issue issue)
Retrieves and returns the Object representing the this CustomField value for the given issue.
String getValueFromIssue(Issue issue)
Gets the value stored for this field on the provided issue.
Object getValueFromParams(Map params)
Get a field value from the map of parameters passed.
String getViewHtml(FieldLayoutItem fieldLayoutItem, Action action, Issue issue)
String getViewHtml(FieldLayoutItem fieldLayoutItem, Action action, Issue issue, Object value, Map displayParameters)
String getViewHtml(FieldLayoutItem fieldLayoutItem, Action action, Issue issue, Map displayParameters)
boolean hasParam(Map parameters)
boolean hasValue(Issue issue)
Determines if the field has a value for the given issue.
int hashCode()
boolean isAllIssueTypes()
Returns true if it applies for all issue types, false otherwise.
boolean isAllProjects()
Checks whether this custom field applies for all projects.
boolean isEditable()
Returns true if this custom field has an edit template, false otherwise.
boolean isEnabled()
Returns true if all configuration schemes returned by getConfigurationSchemes() are enabled.
boolean isGlobal()
Returns true if this custom field applies for all projects and all issue types.
boolean isInScope(Project project, List<String> issueTypeIds)
Determines if this custom field is within the scope of the given project, and list of Issue Types.
boolean isInScope(long projectId, String issueTypeId)
Determines if this custom field is within the scope of the given project, and Issue Type.
boolean isInScope(SearchContext searchContext)
Determines whether this custom field is in scope.
boolean isInScopeForSearch(Project project, List<String> issueTypeIds)
Determines if this custom field is within the scope of the given project, and list of Issue Types.
boolean isRelevantForIssueContext(IssueContext issueContext)
Returns true if the custom field has a config for the Project and Issue Type of the given IssueContext.
boolean isRenderable()
This is the conjunction point with CustomFieldTypes and this is delegated off to customField Types.
boolean isShown(Issue issue)
Tests field specific way to determine if it should be shown or not.
MessagedResult needsMove(Collection originalIssues, Issue targetIssue, FieldLayoutItem targetFieldLayoutItem)
Used to determine if the field needs input from user to be moved to the new project and/or issue type.
void populateDefaults(Map<StringObject> customFieldValuesHolder, Issue issue)
Populate the fieldValueHolder with a value that should be shown by default when the issue has not been created yet.
void populateForMove(Map<StringObject> fieldValuesHolder, Issue originalIssue, Issue targetIssue)
Used to populate the fieldValueHolder with parameters for move issue screen.
void populateFromIssue(Map<StringObject> customFieldValuesHolder, Issue issue)
Puts the custom field parameters retrieved from the given issue to the given customFieldValuesHolder map.
void populateFromParams(Map<StringObject> customFieldValuesHolder, Map<StringString[]> params)
Puts the relevant parameters from the given params map to the given customFieldValuesHolder map.
void populateParamsFromString(Map<StringObject> fieldValuesHolder, String stringValue, Issue issue)
Does nothing.
String prettyPrintChangeHistory(String changeHistory, I18nHelper i18nHelper)
Returns the same string.
String prettyPrintChangeHistory(String changeHistory)
Returns the same string.
Set<Long> remove()
Removes this custom field and returns a set of issue IDs of all issues that are affected by removal of this custom field.
void removeValueFromIssueObject(MutableIssue issue)
Removes the field value from the given MutableIssue object.
String toString()
void updateIssue(FieldLayoutItem fieldLayoutItem, MutableIssue issue, Map fieldValueHolder)
Record the value on the issue (not saving it to the database, see updateValue).
void updateValue(FieldLayoutItem fieldLayoutItem, Issue issue, ModifiedValue modifiedValue, IssueChangeHolder issueChangeHolder)
Update the issue in the data store.
void validateFromActionParams(Map actionParameters, ErrorCollection errorCollection, FieldConfig config)
Validates relevant parameters on custom field type of this custom field.
void validateParams(OperationContext operationContext, ErrorCollection errorCollectionToAddTo, I18nHelper i18n, Issue issue, FieldScreenRenderLayoutItem fieldScreenRenderLayoutItem)
Ensure that the parameters are valid
Protected Methods
static boolean areDifferent(Object obj1, Object obj2)
Compare two objects - return false if both are null or equal.
GenericValue copyGenericValue()
Non-public method that returns a copy of the underlying GenericValue.
EventPublisher getEventPublisher()
Overridable location to retrieve an EventPublisher to publish events through.
I18nHelper getI18nHelper()
CustomFieldParams getRelevantParams(Map<StringString[]> params)
Returns custom field parameter from the given map that are relevant to this custom field.
boolean hasBulkUpdatePermission(BulkEditBean bulkEditBean, Issue issue)
Checks whether the user has the permission to execute the bulk operation for the provided issue.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.issue.fields.ConfigurableField
From interface com.atlassian.jira.issue.fields.CustomField
From interface com.atlassian.jira.issue.fields.Field
From interface com.atlassian.jira.issue.fields.NavigableField
From interface com.atlassian.jira.issue.fields.OrderableField
From interface com.atlassian.jira.issue.fields.SearchableField
From interface com.atlassian.jira.issue.fields.renderer.RenderableField
From interface com.atlassian.jira.issue.fields.rest.RestAwareField
From interface com.atlassian.jira.issue.fields.rest.RestFieldOperations
From interface java.lang.Comparable

Public Methods

public String availableForBulkEdit (BulkEditBean bulkEditBean)

Checks if custom field is available for bulk edit operation, whether 'shown' and if user has bulk update permission. Also checks that all selected issues have the same field config for this custom field. All field configs must be the same or all null.

Parameters
bulkEditBean bulk edit bean
Returns
  • null if available for bulk edit or an appropriate 'unavailable' string

public boolean canRemoveValueFromIssueObject (Issue issue)

Returns true if a call to removeValueFromIssueObject(com.atlassian.jira.issue.MutableIssue) will actually remove the value.

There a few different reasons why this method may return false:

  • The OrderableField can sometimes remove the value, but it decides that it is not relevant for this Issue. eg: Security Level will ignore remove requests on a subtask, as the subtask Security is not set explicitly (it is always inherited from its parent issue).
  • It may possible to remove this value, but the OrderableField does not actually do the job, it is done through some special mechanism. eg Attachments.
  • This field is some special system field which it is invalid to remove. eg Project. In these cases calling removeValueFromIssueObject() would normally raise an UnsupportedOperationException.
In general it is safe to call removeValueFromIssueObject() even if this method returns false, as the request will be silently ignored. However there are a couple of special fields where calling removeValueFromIssueObject() will throw an UnsupportedOperationException - eg if you try to remove the Project.

Parameters
issue The Issue object.
Returns

public int compare (Issue issue1, Issue issue2)

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.

This method returns 0 if this custom field is not sortable, or its customFieldType is not an instance of SortableCustomField

If either of given issues is null a IllegalArgumentException is thrown.

Parameters
issue1 issue to compare
issue2 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

public int compareTo (Object o)

public SearchHandler createAssociatedSearchHandler ()

Return SearchHandler for the field. This object tells JIRA how to search for values within the field.

Returns
  • the SearchHandler associated with the field. Can return null when no searcher is associated with the field. This will mainly happen when a customfield is configured to have no searcher.

public void createValue (Issue issue, Object value)

public boolean equals (Object o)

public List<IssueType> getAssociatedIssueTypeObjects ()

Returns a list of issue types associated with this custom field. Will be null if the field is global

Returns
  • List of issue type generic values

public List<IssueType> getAssociatedIssueTypes ()

Returns a list of issue types associated with this custom field. Will be null if the field is global

Returns
  • List of issue type generic values

public List<Project> getAssociatedProjectObjects ()

Returns a list of projects associated with this custom field. Will be null if the field is global

Returns
  • a list of projects associated with this custom field.

public String getBulkEditHtml (OperationContext operationContext, Action action, BulkEditBean bulkEditBean, Map displayParameters)

Returns HTML that should be shown when the issue is being bulk edited.

Parameters
operationContext OperationContext
action Action
bulkEditBean BulkEditBean
displayParameters Map of display parameters.
Returns
  • HTML that should be shown when the issue is being edited.

public 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.

public String getColumnCssClass ()

public String getColumnHeadingKey ()

public String getColumnViewHtml (FieldLayoutItem fieldLayoutItem, Map displayParams, Issue issue)

public List getConfigurationItemTypes ()

Returns a List of FieldConfigItemType objects. This opens up possibilties for configurable custom fields

Returns

public List<FieldConfigScheme> getConfigurationSchemes ()

Returns a list of configuration schemes.

Returns

public String getCreateHtml (FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue, Map dispayParameters)

Returns the HTML that should be shown when the issue is being created.

Parameters
fieldLayoutItem FieldLayoutItem
operationContext OperationContext
action Action
issue Issue
dispayParameters Map of display parameters.
Returns
  • the HTML that should be shown when the issue is being created.

public String getCreateHtml (FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue)

Returns the HTML that should be shown when the issue is being created.

Parameters
fieldLayoutItem FieldLayoutItem
operationContext OperationContext
action Action
issue Issue
Returns
  • the HTML that should be shown when the issue is being created.

public CustomFieldSearcher getCustomFieldSearcher ()

Retrieves the CustomFieldSearcher for this custom field looking it up in the customFieldManager by the searcher key retrieved from ENTITY_CUSTOM_FIELD_SEARCHER underlying generic value attribute. The seracher, if found is initialized with this custom field before it is returned.

Returns
  • found custom field searcher or null, if none found

public CustomFieldType getCustomFieldType ()

Looks up the CustomFieldType in the #customFieldTypeModuleDescriptors by the key retrieved from the ENTITY_CF_TYPE_KEY attribute of the underlying generic value. This only happens once if #typeRef is null, then the custom field type is set and returned each time. It can return null if the custom field type cannot be found by that key.

Returns
  • custom field type

public CustomFieldParams getCustomFieldValues (Map customFieldValuesHolder)

Get the custom field string values that are relevant to this particular custom field

Parameters
customFieldValuesHolder containing all params
Returns

public String getDefaultSortOrder ()

Returns

public Object getDefaultValue (Issue issue)

The value that should be set on the issue if the field is not shown for some reason.

For example: The user does not have permission to see the field, or the field is not part of the create screen.

Parameters
issue the Issue.
Returns
  • The default value. It can be null.

public String getDescription ()

Returns the i18n'ed description of this custom field.

Returns
  • the description of this custom field

@Nonnull public RenderableProperty getDescriptionProperty ()

Returns a RenderableProperty for rendering this custom field's description.

Returns
  • a read-only RenderableProperty

public String getEditHtml (FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue, Map dispayParameters)

Returns HTML that should be shown when the issue is being edited.

Parameters
fieldLayoutItem FieldLayoutItem
operationContext OperationContext
action Action
issue Issue
dispayParameters Map of display parameters.
Returns
  • HTML that should be shown when the issue is being edited.

public String getEditHtml (FieldLayoutItem fieldLayoutItem, OperationContext operationContext, Action action, Issue issue)

Returns HTML that should be shown when the issue is being edited.

Parameters
fieldLayoutItem FieldLayoutItem
operationContext OperationContext
action Action
issue Issue
Returns
  • HTML that should be shown when the issue is being edited.

public String getFieldName ()

Returns the title of this custom field.

Returns
  • the title of this custom field

public FieldTypeInfo getFieldTypeInfo (FieldTypeInfoContext fieldTypeInfoContext)

Returns lower level Information about the field. This information contains allowed values and/or the autocomplete url

Parameters
fieldTypeInfoContext the FieldTypeInfoContext contains context information that is relevant to generate the FieldTypeInfo

public GenericValue getGenericValue ()

Returns a generic value that represents this custom field. (only for internal use, it is deprecated on interface)

Returns
  • generic value of this custom field

public String getHiddenFieldId ()

Returns the id of the field to check for visibility. For example, with original estimate field need to ensure that the timetracking field is not hidden. With most fields, this is the same as their id.

public String getId ()

Returns the identifier for this RenderableField.

Returns
  • the identifier for this RenderableField.

public Long getIdAsLong ()

Returns ID of this custom field.

Returns
  • ID of this custom field

public JsonData getJsonDefaultValue (IssueContext issueCtx)

Return The default data for this system field. May be null if there is no default.

Parameters
issueCtx Issue (This should really only need to be an issue context, but for historical reasons we need an issue object.

public FieldJsonRepresentation getJsonFromIssue (Issue issue, boolean renderedVersionRequested, FieldLayoutItem fieldLayoutItem)

Return a FieldJsonDataPair containing a json representation of the raw data for this field, and if required, a json representation of the rendered data for easy display.

Parameters
issue to get field data from
renderedVersionRequested whether the use requested the return of rendered/pretty data as well as raw data
fieldLayoutItem field layout for this field. Will only be supplied if the field is also an ordereable field.
Returns
  • FieldJsonDataPair containing a json representation of the raw data for this field, and if required, a json representation of the rendered data for easy display.

public JsonType getJsonSchema ()

Return a description of the shape of this field when represented as JSON.

public String getName ()

Returns the name of this custom field.

Returns
  • the name of this custom field

public String getNameKey ()

The i18n key that is used to lookup the field's name when it is displayed

public Options getOptions (String key, FieldConfig config, JiraContextNode contextNode)

Returns options for this custom field if it is of MultipleCustomFieldType type. Otherwise returns null.

Parameters
key not used
config relevant field config
contextNode JIRA context node
Returns

public Options getOptions (String key, JiraContextNode jiraContextNode)

Returns options for this custom field if it is of MultipleCustomFieldType type. Otherwise returns null.

Parameters
key not used
jiraContextNode JIRA context node
Returns

public static String getParamKeyIssueId ()

Name of the parameter that stores the issue id in the current context in CustomFieldParams. This is useful for getting data such as the previous value.

public static String getParamKeyProjectId ()

Name of the parameter that stores the project id of the associated issue in the current context in CustomFieldParams.

public PropertySet getPropertySet ()

public FieldConfig getRelevantConfig (Issue issue)

Returns a relevant FieldConfig for 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 FieldConfig representing 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.

public FieldConfig getRelevantConfig (IssueContext issueContext)

Returns the relevant field config of this custom field for the give issue context

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

public FieldConfig getReleventConfig (SearchContext searchContext)

Return the relevant field config for the search context specified. 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

public RestFieldOperationsHandler getRestFieldOperation ()

public FieldComparatorSource getSortComparatorSource ()

Return a SortComparatorSource that uses either a custom field searcher that implements SortableCustomFieldSearcher or a custom field that implements SortableCustomField. If neither are found, this method returns null.

Returns
  • A SortComparatorSource that can be used to sort, or null if this field does not use custom sorting

public List<SortField> getSortFields (boolean sortOrder)

Return a list of Lucene SortFields to be used for sorting search results.

Using this method allows the field to specify the most performant way to perform a search. If a field can be sorted directly using the term in the index then this should just return a singleton list with the sort field.

return Collections.singletonList(new SortField(fieldName, sortOrder));

The default implementation builds this using the FieldComparatorSource returned by getSortComparatorSource()

If you implement this method there is no need to implement getSortComparatorSource().

Returns
  • The name of the indexed term to be used for native Lucene sorting.

public LuceneFieldSorter getSorter ()

If this field has a searcher, and this searcher implements SortableCustomFieldSearcher then return getSorter(CustomField). Else return null.

Returns

public String getUntranslatedDescription ()

Returns the description of this custom field by reading ENTITY_DESCRIPTION of the underlying generic value.

Returns
  • the description of this custom field

@Nonnull public RenderableProperty getUntranslatedDescriptionProperty ()

Returns a RenderableProperty for rendering this custom field's description.

Returns
  • a read-only RenderableProperty

public String getUntranslatedName ()

Returns the name of this custom field by reading ENTITY_NAME of the underlying generic value.

Returns
  • the name of this custom field

public Object getValue (Issue issue)

Retrieves and returns the Object representing the this CustomField value for the given issue. See getValueFromIssue(CustomField, Issue)

Parameters
issue issue to retrieve the value from
Returns
  • Object representing the this CustomField value for the given issue

public String getValueFromIssue (Issue issue)

Gets the value stored for this field on the provided issue.

Parameters
issue identifies the issue that will contain the value for this field.
Returns
  • the value stored on this issue for this field, null if not applicable.

public Object getValueFromParams (Map params)

Get a field value from the map of parameters passed. The params map may contain other parameters that are not relevant to this custom field.

Parameters
params the map of parameters.
Returns
  • Value for this field from the map of parameters.

public String getViewHtml (FieldLayoutItem fieldLayoutItem, Action action, Issue issue)

public String getViewHtml (FieldLayoutItem fieldLayoutItem, Action action, Issue issue, Object value, Map displayParameters)

public String getViewHtml (FieldLayoutItem fieldLayoutItem, Action action, Issue issue, Map displayParameters)

public boolean hasParam (Map parameters)

public boolean hasValue (Issue issue)

Determines if the field has a value for the given issue.

Parameters
issue the Issue.
Returns
  • true if the given Issue has a value for this field.

public int hashCode ()

public boolean isAllIssueTypes ()

Returns true if it applies for all issue types, false otherwise. The actual check test if the list returned by getAssociatedIssueTypes() contains null - all issue types.

Returns
  • true if it applies for all issue types, false otherwise.

public 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.

public boolean isEditable ()

Returns true if this custom field has an edit template, false otherwise.

Returns
  • true if this custom field has an edit template, false otherwise.

public boolean isEnabled ()

Returns true if all configuration schemes returned by getConfigurationSchemes() are enabled.

Returns
  • true if all configuration schemes are enabled, false otherwise

public 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.

public boolean isInScope (Project project, List<String> issueTypeIds)

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
  • true if this custom field is within the given scope.

public boolean isInScope (long projectId, String issueTypeId)

Determines if this custom field is within the scope of the given project, and Issue Type.

Parameters
projectId The project.
issueTypeId The issueTypeId
Returns
  • true if this custom field is within the given scope.

public boolean isInScope (SearchContext searchContext)

Determines whether this custom field is in scope.

Parameters
searchContext search context
Returns
  • true if this field is in scope

public boolean isInScopeForSearch (Project project, List<String> issueTypeIds)

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 FieldConfigScheme of 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 FieldConfigScheme that 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.

public boolean isRelevantForIssueContext (IssueContext issueContext)

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 FieldConfig representing 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.

public boolean isRenderable ()

This is the conjunction point with CustomFieldTypes and this is delegated off to customField Types.

Returns
  • true if the custom field supports interaction with the renderers, false otherwise. Text based fields will be able to interact with the renderers.

public boolean isShown (Issue issue)

Tests field specific way to determine if it should be shown or not.

Parameters
issue The Issue.
Returns
  • true if it should be shown.

public MessagedResult needsMove (Collection originalIssues, Issue targetIssue, FieldLayoutItem targetFieldLayoutItem)

Used to determine if the field needs input from user to be moved to the new project and/or issue type. This method is called only if the field is visible in the target project/issue type.

Parameters
originalIssues Collection of original Issues.
targetIssue Target Issue.
targetFieldLayoutItem FieldLayoutItem
Returns
  • A MessagedResult with result=true if the field needs input to be moved.

public void populateDefaults (Map<StringObject> customFieldValuesHolder, Issue issue)

Populate the fieldValueHolder with a value that should be shown by default when the issue has not been created yet.

Parameters
customFieldValuesHolder The fieldValuesHolder Map to be populated.
issue The Issue.

public void populateForMove (Map<StringObject> fieldValuesHolder, Issue originalIssue, Issue targetIssue)

Used to populate the fieldValueHolder with parameters for move issue screen. This field is only called if the issue needs to be updated during move, i.e. needsMove(java.util.Collection, com.atlassian.jira.issue.Issue, com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem) returned true, and the remote user (the one performing the move) has the permission to actually update this field.

Parameters
fieldValuesHolder Map of field Values.
originalIssue orignal Issue
targetIssue target Issue

public void populateFromIssue (Map<StringObject> customFieldValuesHolder, Issue issue)

Puts the custom field parameters retrieved from the given issue to the given customFieldValuesHolder map.

Parameters
customFieldValuesHolder map of custom field values
issue issue to get the custom field parameters from

public void populateFromParams (Map<StringObject> customFieldValuesHolder, Map<StringString[]> params)

Puts the relevant parameters from the given params map to the given customFieldValuesHolder map.

Parameters
customFieldValuesHolder map of custom field values
params map of parameters

public void populateParamsFromString (Map<StringObject> fieldValuesHolder, String stringValue, Issue issue)

Does nothing. Throws UnsupportedOperationException.

Parameters
fieldValuesHolder not used
stringValue not used
issue not used

public String prettyPrintChangeHistory (String changeHistory, I18nHelper i18nHelper)

Returns the same string.

Parameters
changeHistory change history string
i18nHelper not used
Returns
  • change history string

public String prettyPrintChangeHistory (String changeHistory)

Returns the same string.

Parameters
changeHistory change history string
Returns
  • change history string

public Set<Long> remove ()

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

public void removeValueFromIssueObject (MutableIssue issue)

Removes the field value from the given MutableIssue object.

Note that this operation does not actually persist the change, it just clears the value from the given Issue object. The caller will still need to call #updateValue() in order to persist the change.

Some Fields may choose to quietly ignore this request. eg The SecurityLevel Field will not remove Security Level from subtasks because the subtask must always take the Security Level of its parent issue.

Parameters
issue The issue object to be effected.

public String toString ()

public void updateIssue (FieldLayoutItem fieldLayoutItem, MutableIssue issue, Map fieldValueHolder)

Record the value on the issue (not saving it to the database, see updateValue).

Parameters
fieldLayoutItem FieldLayoutItem
issue MutableIssue
fieldValueHolder Field Value Holder Map

public void updateValue (FieldLayoutItem fieldLayoutItem, Issue issue, ModifiedValue modifiedValue, IssueChangeHolder issueChangeHolder)

Update the issue in the data store.

Fields that are simply stored in the JIRAISSUE DB table, need not do anything here as this table is written to one time to include all fields that changed. Fields using other DB tables must update that table with the appropriate values.

Parameters
fieldLayoutItem for this field within this context
issue Issue this field is part of
modifiedValue new value to set field to. Cannot be null.
issueChangeHolder an object to record any changes made to the issue by this method.

public 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. See validateFromParams(CustomFieldParams, ErrorCollection, FieldConfig)

Parameters
actionParameters action parameters
errorCollection error collection to add errors to
config field config

public void validateParams (OperationContext operationContext, ErrorCollection errorCollectionToAddTo, I18nHelper i18n, Issue issue, FieldScreenRenderLayoutItem fieldScreenRenderLayoutItem)

Ensure that the parameters are valid

Parameters
operationContext OperationContext
errorCollectionToAddTo ErrorCollection to add to.
i18n I18nHelper
issue This is passed to get the value of other fields that may or may not have been modified.
fieldScreenRenderLayoutItem FieldScreenRenderLayoutItem

Protected Methods

protected static boolean areDifferent (Object obj1, Object obj2)

Compare two objects - return false if both are null or equal. Return true otherwise.

Parameters
obj1 the first object to compare
obj2 the second object to compare
Returns
  • false if both are null or equal. Return true otherwise.

protected GenericValue copyGenericValue ()

Non-public method that returns a copy of the underlying GenericValue. This is essentially only used in the above copy constructor.

Prefer this class's get* method instead.

Returns
  • the underlying GenericValue

protected EventPublisher getEventPublisher ()

Overridable location to retrieve an EventPublisher to publish events through. It's not injected via the constructor because it has too many adverse impacts on APIs and existing usages.

Returns
  • an EventPublisher.

protected I18nHelper getI18nHelper ()

protected CustomFieldParams getRelevantParams (Map<StringString[]> params)

Returns custom field parameter from the given map that are relevant to this custom field.

Parameters
params map of parameters
Returns
  • custom field parameter from the given map that are relevant to this custom field

protected boolean hasBulkUpdatePermission (BulkEditBean bulkEditBean, Issue issue)

Checks whether the user has the permission to execute the bulk operation for the provided issue. In case of Bulk Workflow Transition checks for nothing. In case of all others (e.g. Bulk Edit) checks for Edit permission.

Parameters
bulkEditBean bulk edit bean
issue issue to check permission on
Returns
  • true if has permission, false otherwise