com.atlassian.jira.issue.fields
Interface CustomField

All Superinterfaces:
Comparable, ConfigurableField, Field, HideableField, NavigableField, OrderableField, RenderableField, RequirableField, RestAwareField, RestFieldOperations, SearchableField
All Known Implementing Classes:
CustomFieldImpl, CustomFieldTestImpl, MockCustomField

@PublicApi
public interface CustomField
extends NavigableField, HideableField, ConfigurableField, RenderableField, RequirableField, OrderableField, RestAwareField, RestFieldOperations

Custom Field interface.

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

See Also:
CustomFieldType - The type of custom field (text, number, user picker etc).

Field Summary
static String ENTITY_CF_TYPE_KEY
           
static String ENTITY_CUSTOM_FIELD_SEARCHER
           
static String ENTITY_DESCRIPTION
           
static String ENTITY_ID
           
static String ENTITY_ISSUETYPE
           
static String ENTITY_NAME
           
static String ENTITY_PROJECT
           
static String ENTITY_TABLE_NAME
           
 
Fields inherited from interface com.atlassian.jira.issue.fields.NavigableField
ORDER_ASCENDING, ORDER_DESCENDING, TEMPLATE_DIRECTORY_PATH
 
Fields inherited from interface com.atlassian.jira.issue.fields.OrderableField
MOVE_ISSUE_PARAM_KEY, NO_HEADER_PARAM_KEY
 
Method Summary
 int compare(Issue issue1, Issue issue2)
          This method compares the values of this custom field in two given issues.
 List<org.ofbiz.core.entity.GenericValue> getAssociatedIssueTypes()
          Returns a list of issue types associated with this custom field.
 List<org.ofbiz.core.entity.GenericValue> getAssociatedProjectCategories()
          Returns a list of associated project categories for this custom field.
 List<ProjectCategory> getAssociatedProjectCategoryObjects()
          Returns a list of associated project categories for this custom field.
 List<Project> getAssociatedProjectObjects()
          Returns a list of projects associated with this custom field.
 List<org.ofbiz.core.entity.GenericValue> getAssociatedProjects()
          Deprecated. Use getAssociatedProjectObjects() instead. Since v5.2.
 ClauseNames getClauseNames()
          Return the JQL clause names that this custom field should be recognized by.
 List<FieldConfigScheme> getConfigurationSchemes()
          Returns a list of configuration schemes.
 CustomFieldSearcher getCustomFieldSearcher()
          Retrieves the CustomFieldSearcher for this custom field.
 CustomFieldType getCustomFieldType()
          Looks up the CustomFieldType.
 CustomFieldParams getCustomFieldValues(Map customFieldValuesHolder)
          Get the custom field string values that are relevant to this particular custom field
 String getDescription()
          Returns the 1i8n'ed description of this custom field.
 RenderableProperty getDescriptionProperty()
          Returns a RenderableProperty for rendering this custom field's description.
 String getFieldName()
          Returns the title of this custom field.
 org.ofbiz.core.entity.GenericValue getGenericValue()
          Deprecated. Use Field.getName(), getDescription(), etc. Since v3.0.
 Long getIdAsLong()
          Returns ID of this custom field.
 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.
 com.opensymphony.module.propertyset.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)
          The FieldConfig that is relevent to all issue contexts in the search context Checks that all configs within search context are the same - i.e.
 String getUntranslatedDescription()
          Returns the description of this custom field by reading ENTITY_DESCRIPTION of the underlying generic value.
 RenderableProperty getUntranslatedDescriptionProperty()
          Returns a RenderableProperty for rendering this custom field's untranslated description, for admin.
 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.
 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 can be edited, 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(org.ofbiz.core.entity.GenericValue project, List<String> issueTypeIds)
          Deprecated. Please use isInScope(com.atlassian.jira.project.Project, java.util.List). This method was created in v4.3 as a temporary compatibility measure and has been always deprecated.
 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(SearchContext searchContext)
          Determines whether this custom field is in scope.
 boolean isInScope(com.atlassian.crowd.embedded.api.User user, SearchContext searchContext)
          Deprecated. Use isInScope(com.atlassian.jira.issue.search.SearchContext) instead. Since v4.3
 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 setCustomFieldSearcher(CustomFieldSearcher searcher)
          Sets the CustomFieldSearcher for this custom field.
 void setDescription(String description)
          Sets the description of this custom field.
 void setName(String name)
          Sets the name of this custom field.
 void store()
          Stores this custom field.
 void validateFromActionParams(Map actionParameters, ErrorCollection errorCollection, FieldConfig config)
          Validates relevant parameters on custom field type of this custom field.
 
Methods inherited from interface com.atlassian.jira.issue.fields.NavigableField
getColumnCssClass, getColumnHeadingKey, getColumnViewHtml, getDefaultSortOrder, getHiddenFieldId, getSortComparatorSource, getSorter, getSortFields, prettyPrintChangeHistory, prettyPrintChangeHistory
 
Methods inherited from interface com.atlassian.jira.issue.fields.ConfigurableField
getConfigurationItemTypes
 
Methods 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, validateParams
 
Methods inherited from interface com.atlassian.jira.issue.fields.SearchableField
createAssociatedSearchHandler
 
Methods inherited from interface com.atlassian.jira.issue.fields.Field
getId, getName, getNameKey
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface com.atlassian.jira.issue.fields.renderer.RenderableField
getId, getValueFromIssue, isRenderable
 
Methods inherited from interface com.atlassian.jira.issue.fields.rest.RestAwareField
getFieldTypeInfo, getJsonFromIssue, getJsonSchema
 
Methods inherited from interface com.atlassian.jira.issue.fields.rest.RestFieldOperations
getJsonDefaultValue, getRestFieldOperation
 

Field Detail

ENTITY_CF_TYPE_KEY

static final String ENTITY_CF_TYPE_KEY
See Also:
Constant Field Values

ENTITY_CUSTOM_FIELD_SEARCHER

static final String ENTITY_CUSTOM_FIELD_SEARCHER
See Also:
Constant Field Values

ENTITY_NAME

static final String ENTITY_NAME
See Also:
Constant Field Values

ENTITY_ISSUETYPE

static final String ENTITY_ISSUETYPE
See Also:
Constant Field Values

ENTITY_PROJECT

static final String ENTITY_PROJECT
See Also:
Constant Field Values

ENTITY_ID

static final String ENTITY_ID
See Also:
Constant Field Values

ENTITY_DESCRIPTION

static final String ENTITY_DESCRIPTION
See Also:
Constant Field Values

ENTITY_TABLE_NAME

static final String ENTITY_TABLE_NAME
See Also:
Constant Field Values
Method Detail

isInScope

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.

If the issueTypeIds list is null or an empty list, then it is treated as a wildcard.

Parameters:
project - The project.
issueTypeIds - List of IssueType ID's.
Returns:
true if this custom field is within the given scope.

isInScope

@Deprecated
boolean isInScope(org.ofbiz.core.entity.GenericValue project,
                             List<String> issueTypeIds)
Deprecated. Please use isInScope(com.atlassian.jira.project.Project, java.util.List). This method was created in v4.3 as a temporary compatibility measure and has been always deprecated.

This is used for determining whether we can view a custom field in view issue.

Parameters:
project - project generic value
issueTypeIds - issue type IDs, e.g. ["1", "2"] for Bugs and New Features
Returns:
true if the field is to be shown, false if hidden

isInScope

boolean isInScope(SearchContext searchContext)
Determines whether this custom field is in scope.

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

isInScope

boolean isInScope(com.atlassian.crowd.embedded.api.User user,
                  SearchContext searchContext)
Deprecated. Use isInScope(com.atlassian.jira.issue.search.SearchContext) instead. Since v4.3

Determines whether this custom field is in scope.

Parameters:
user - current user
searchContext - search context
Returns:
true if this field is in scope

getGenericValue

@Deprecated
org.ofbiz.core.entity.GenericValue getGenericValue()
Deprecated. Use Field.getName(), getDescription(), etc. Since v3.0.

Returns a generic value that represents this custom field

Returns:
generic value of this custom field

compare

int compare(Issue issue1,
            Issue issue2)
            throws IllegalArgumentException
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 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

getCustomFieldValues

CustomFieldParams getCustomFieldValues(Map customFieldValuesHolder)
Get the custom field string values that are relevant to this particular custom field

Parameters:
customFieldValuesHolder - containing all params
Returns:
a CustomFieldParams of String objects

getValue

Object getValue(Issue issue)
Retrieves and returns the Object representing the this CustomField value for the given issue. See CustomFieldType.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:
OrderableField.getValueFromParams(java.util.Map)

remove

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

getOptions

Options getOptions(String key,
                   JiraContextNode jiraContextNode)
Returns options for this custom field if it is of MultipleCustomFieldType type. Otherwise returns null.

As this is just used by the view layer, it can be a list of objects

Parameters:
key - not used
jiraContextNode - JIRA context node
Returns:
options for this custom field if it is of MultipleCustomFieldType type, null otherwise

setName

void setName(String name)
Sets the name of this custom field.

Parameters:
name - name to set

getDescription

String getDescription()
Returns the 1i8n'ed description of this custom field. To render views for the custom field description, prefer getDescriptionProperty().

Returns:
the description of this custom field

getUntranslatedDescription

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

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 reading ENTITY_NAME of the underlying generic value.

Returns:
the name of this custom field

getDescriptionProperty

@Nonnull
RenderableProperty getDescriptionProperty()
Returns a RenderableProperty for rendering this custom field's description.

Returns:
a read-only RenderableProperty
Since:
v5.0.7

getUntranslatedDescriptionProperty

@Nonnull
RenderableProperty getUntranslatedDescriptionProperty()
Returns a RenderableProperty for rendering this custom field's untranslated description, for admin.

Returns:
a read-only RenderableProperty
Since:
v5.0.7

setDescription

void setDescription(String description)
Sets the description of this custom field.

Parameters:
description - description to set

getCustomFieldSearcher

CustomFieldSearcher getCustomFieldSearcher()
Retrieves the CustomFieldSearcher for this custom field. The seracher, if found is initialized with this custom field before it is returned.

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

setCustomFieldSearcher

void setCustomFieldSearcher(CustomFieldSearcher searcher)
Sets the CustomFieldSearcher for this custom field.

Parameters:
searcher - custom field searcher to associate with this custom field

store

void store()
Stores this custom field.


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

getConfigurationSchemes

List<FieldConfigScheme> getConfigurationSchemes()
Returns a list of configuration schemes.

Returns:
a list of FieldConfigScheme objects.

getOptions

Options getOptions(String key,
                   FieldConfig config,
                   JiraContextNode contextNode)
Returns options for this custom field if it is of MultipleCustomFieldType type. Otherwise returns null.

As this is just used by the view layer, it can be a list of objects

Parameters:
key - not used
config - relevant field config
contextNode - JIRA context node
Returns:
options for this custom field if it is of MultipleCustomFieldType type, null otherwise

getRelevantConfig

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

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

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

getAssociatedProjectCategories

List<org.ofbiz.core.entity.GenericValue> getAssociatedProjectCategories()
Returns a list of associated project categories for this custom field. It returns null if getConfigurationSchemes() returns null. It returns an empty list if the getConfigurationSchemes() returns an empty list. The returned list should be sorted by project category name.

Returns:
a list of GenericValue objects that represent associated project categories as ProjectCategoryContext objects

getAssociatedProjectCategoryObjects

List<ProjectCategory> getAssociatedProjectCategoryObjects()
Returns a list of associated project categories for this custom field. It returns null if getConfigurationSchemes() returns null. It returns an empty list if the getConfigurationSchemes() returns an empty list. The returned list should be sorted by project category name.

Returns:
a list of ProjectCategory objects that represent associated project categories as ProjectCategoryContext objects

getAssociatedProjects

List<org.ofbiz.core.entity.GenericValue> getAssociatedProjects()
Deprecated. Use getAssociatedProjectObjects() instead. Since v5.2.

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

Specified by:
getAssociatedProjects in interface ConfigurableField
Returns:
List of project generic values

getAssociatedProjectObjects

List<Project> getAssociatedProjectObjects()
Returns a list of projects associated with this custom field. Will be null if the field is global

Specified by:
getAssociatedProjectObjects in interface ConfigurableField
Returns:
a list of projects associated with this custom field.

getAssociatedIssueTypes

List<org.ofbiz.core.entity.GenericValue> 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

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 all configuration schemes returned by getConfigurationSchemes() are enabled.

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

getCustomFieldType

CustomFieldType getCustomFieldType()
Looks up the CustomFieldType. It can return null if the custom field type cannot be found in the CustomFieldManager.

Returns:
custom field type

getRelevantConfig

FieldConfig getRelevantConfig(IssueContext issueContext)
Returns the relevant field config of this custom field for the give issue context

Specified by:
getRelevantConfig in interface ConfigurableField
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

getReleventConfig

FieldConfig getReleventConfig(SearchContext searchContext)
The FieldConfig that 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()


Copyright © 2002-2013 Atlassian. All Rights Reserved.