java.lang.Object
   ↳ com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType<T, S>
     ↳ com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType<T>
       ↳ com.atlassian.jira.issue.customfields.impl.SelectCFType

Class Overview

Select Custom Field Type allows selecting of a single Option. Transport Object is Option

dl>

Transport Object Type
Option
Database Storage Type
String of Option ID

Summary

Nested Classes
interface SelectCFType.Visitor<T>  
[Expand]
Inherited Constants
From class com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType
From interface com.atlassian.jira.issue.customfields.CustomFieldType
[Expand]
Inherited Fields
From class com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType
Public Constructors
SelectCFType(CustomFieldValuePersister customFieldValuePersister, OptionsManager optionsManager, GenericConfigManager genericConfigManager, JiraBaseUrls jiraBaseUrls)
Public Methods
Object accept(VisitorBase visitor)
int compare(String customFieldObjectValue1, String customFieldObjectValue2, FieldConfig fieldConfig)
String getChangelogString(CustomField field, Option value)
Returns a String of representing values to be stored in the change log, an example is the name of a version field that a version id will resolve to within JIRA.
@Nonnull List<FieldConfigItemType> getConfigurationItemTypes()
Returns a List of FieldConfigItemType objects.
Option getDefaultValue(FieldConfig fieldConfig)
FieldTypeInfo getFieldTypeInfo(FieldTypeInfoContext fieldTypeInfoContext)
Returns lower level Information about the field.
Set<Long> getIssueIdsWithValue(CustomField field, Option option)
Returns a Set of issue ids (Long) that have the given option selected.
JsonData getJsonDefaultValue(IssueContext issueCtx, CustomField field)
FieldJsonRepresentation getJsonFromIssue(CustomField field, Issue issue, boolean renderedVersionRequested, FieldLayoutItem fieldLayoutItem)
Return a JsonData representation of the field value
JsonType getJsonSchema(CustomField customField)
Return a description of the shape of this field when represented as JSON.
Options getOptions(FieldConfig config, JiraContextNode jiraContextNode)
Returns all possible Options for this field.
ProjectCustomFieldImporter getProjectImporter()
Returns the object that will perform the actual project import functions for the custom field type.
Query getQueryForGroup(String fieldID, String groupName)
This method should be implemented in your custom type to return a Query.
RestFieldOperationsHandler getRestFieldOperation(CustomField field)
Returns the RestFieldOperationsHandler for this field.
Option getSingularObjectFromString(String string)
Returns a Singular Object, given the string value as passed by the presentation tier.
String getStringFromSingularObject(Option optionObject)
Set<Long> remove(CustomField field)
called when removing a field.
void removeValue(CustomField field, Issue issue, Option option)
This default implementation will remove all values from the custom field for an issue.
void setDefaultValue(FieldConfig fieldConfig, Option option)
void validateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config)
Protected Methods
@Nonnull PersistenceFieldType getDatabaseType()
Type of database field needed to store this field.
Object getDbValueFromObject(Option customFieldObject)
Returns the database representation of the Java object as stored for that CustomField.
Option getObjectFromDbValue(Object databaseValue)
Returns the Transport Object for the given Custom Field value as represented by the value stored in the database
[Expand]
Inherited Methods
From class com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType
From class com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
From class java.lang.Object
From interface com.atlassian.jira.imports.project.customfield.ProjectImportableCustomField
From interface com.atlassian.jira.issue.customfields.CustomFieldType
From interface com.atlassian.jira.issue.customfields.GroupSelectorField
From interface com.atlassian.jira.issue.customfields.MultipleCustomFieldType
From interface com.atlassian.jira.issue.customfields.MultipleSettableCustomFieldType
From interface com.atlassian.jira.issue.customfields.SortableCustomField
From interface com.atlassian.jira.issue.fields.rest.RestAwareCustomFieldType
From interface com.atlassian.jira.issue.fields.rest.RestCustomFieldTypeOperations

Public Constructors

public SelectCFType (CustomFieldValuePersister customFieldValuePersister, OptionsManager optionsManager, GenericConfigManager genericConfigManager, JiraBaseUrls jiraBaseUrls)

Public Methods

public Object accept (VisitorBase visitor)

public int compare (String customFieldObjectValue1, String customFieldObjectValue2, FieldConfig fieldConfig)

public String getChangelogString (CustomField field, Option value)

Returns a String of representing values to be stored in the change log, an example is the name of a version field that a version id will resolve to within JIRA.

Parameters
field CustomField that the value belongs to
value Transport Object representing the value instance of the CustomField
Returns
  • Change log string.

@Nonnull public List<FieldConfigItemType> getConfigurationItemTypes ()

Returns a List of FieldConfigItemType objects. Can not be immutable. This opens up possibilities for configurable custom fields.

Returns

public Option getDefaultValue (FieldConfig fieldConfig)

public FieldTypeInfo getFieldTypeInfo (FieldTypeInfoContext fieldTypeInfoContext)

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

Parameters
fieldTypeInfoContext context information for generating the FieldTypeInfo.
Returns
  • Low level information about the field.

public Set<Long> getIssueIdsWithValue (CustomField field, Option option)

Returns a Set of issue ids (Long) that have the given option selected.

Parameters
field the CustomField to search on
option the Object representing a single value to search on.
Returns
  • Set of Longs

public JsonData getJsonDefaultValue (IssueContext issueCtx, CustomField field)

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

Return a JsonData representation of the field value

Parameters
field configuration of the current field
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.
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 (CustomField customField)

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

public Options getOptions (FieldConfig config, JiraContextNode jiraContextNode)

Returns all possible Options for this field.

Parameters
config configuration for this field
jiraContextNode context
Returns
  • all possible Options for this field.

public ProjectCustomFieldImporter getProjectImporter ()

Returns the object that will perform the actual project import functions for the custom field type.

Returns
  • the object that will perform the actual project import functions for the custom field type.

public Query getQueryForGroup (String fieldID, String groupName)

This method should be implemented in your custom type to return a Query. Generally you should return a TermQuery in the form of fieldName:groupName. However some custom fields, such as (@Link SelectCFType) manipulate the field identifiers and values before storing in the index. In cases like this you will have to implement the method such that it searches the correct fields.

Parameters
fieldID the id of the custom field
groupName the name of the group to filter on
Returns
  • the (@Link Query) to pass to the searcher

public RestFieldOperationsHandler getRestFieldOperation (CustomField field)

Returns the RestFieldOperationsHandler for this field.

Parameters
field the Custom Field
Returns
  • the RestFieldOperationsHandler for this field.

public Option getSingularObjectFromString (String string)

Returns a Singular Object, given the string value as passed by the presentation tier. Throws FieldValidationException if the string is an invalid representation of the Object.

Parameters
string the String
Returns
  • singularObject instance

public String getStringFromSingularObject (Option optionObject)

public Set<Long> remove (CustomField field)

called when removing a field. return issue IDs affected.

Subclasses should override this if they have specific cleanup that they need to do (such as removing select list values)

public void removeValue (CustomField field, Issue issue, Option option)

This default implementation will remove all values from the custom field for an issue. Since there can only be one value for each CustomField instance, this implementation can safely ignore the objectValue

Parameters
field being edited
issue to remove stuff from
option - ignored

public void setDefaultValue (FieldConfig fieldConfig, Option option)

public void validateFromParams (CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config)

Protected Methods

@Nonnull protected PersistenceFieldType getDatabaseType ()

Type of database field needed to store this field.

Returns

protected Object getDbValueFromObject (Option customFieldObject)

Returns the database representation of the Java object as stored for that CustomField. (eg. ProjectId if the Value represents a project). Must be compatable with type returned by getDatabaseType()

Parameters
customFieldObject the Transport Object
Returns
  • String, Double or Date

protected Option getObjectFromDbValue (Object databaseValue)

Returns the Transport Object for the given Custom Field value as represented by the value stored in the database

Parameters
databaseValue - String, Double or Date objects as returned from getDbValueFromObject(Object)
Returns
  • Domain object or GenericValue