com.atlassian.jira.issue.fields
Interface CustomField

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

public interface CustomField
extends NavigableField, HideableField, ConfigurableField, RenderableField, RequirableField, OrderableField

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 (a CustomFieldValue), 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:
CustomFieldValue - a value of this field for a specific issue, CustomFieldType - The type of custom field (text, number, user picker etc).

Field Summary
 
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 getAssociatedIssueTypes()
          Returns a list of issue types associated with this project.
 List getAssociatedProjectCategories()
          Returns a list of associated project categories for this custom field.
 List getAssociatedProjects()
          Returns a list of projects associated with this project.
 List 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 description of this custom field.
 FieldConfig getFirstRelevantConfig(org.ofbiz.core.entity.GenericValue project, List issueTypeIds)
          Deprecated.  
 org.ofbiz.core.entity.GenericValue getGenericValue()
          Deprecated.  
 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.
 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.
 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(User remoteUser, org.ofbiz.core.entity.GenericValue project, List issueTypeIds)
          This is used for determining whether we can view a custom field in view issue.
 boolean isInScope(User user, SearchContext searchContext)
          Determines wheteher this custom field is in scope.
 Set 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, 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, hasValue, isShown, needsMove, populateDefaults, populateForMove, populateFromIssue, populateFromParams, populateParamsFromString, removeValueFromIssueObject, updateIssue, updateValue, validateParams
 
Methods inherited from interface com.atlassian.jira.issue.fields.SearchableField
getAssociatedSearchers
 
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
 

Method Detail

isInScope

boolean isInScope(User remoteUser,
                  org.ofbiz.core.entity.GenericValue project,
                  List issueTypeIds)
This is used for determining whether we can view a custom field in view issue. TODO: Refactor to not use GenericValue.

Parameters:
remoteUser - current user
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

getGenericValue

org.ofbiz.core.entity.GenericValue getGenericValue()
Deprecated. 

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 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 description of this custom field.

Returns:
the description of this custom field

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

getFirstRelevantConfig

FieldConfig getFirstRelevantConfig(org.ofbiz.core.entity.GenericValue project,
                                   List issueTypeIds)
Deprecated. 

Finds relevant field config for the given project and issue type IDs. It returns the first one found. It can also return null if no relevant config is found

Parameters:
project - project
issueTypeIds - issue type IDs
Returns:
first relevant field config found, or null if none found

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

getAssociatedProjects

List getAssociatedProjects()
Returns a list of projects associated with this project. Will be null if the field is global

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

getAssociatedIssueTypes

List getAssociatedIssueTypes()
Returns a list of issue types associated with this project. 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

isInScope

boolean isInScope(User user,
                  SearchContext searchContext)
Determines wheteher this custom field is in scope.

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


Copyright © 2002-2008 Atlassian. All Rights Reserved.