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

Class Overview

Cascading Select Custom Field Type allows for multiple dependent select lists.

Transport Object Type
Map, Option The key in the map represents the field depth of the select list. eg. a key of null is the root parent, and key of "1" is the first level select list. As at JIRA 3.0, there can only be one level.
Singular Object Type
Option
Database Storage Type
String of option id

Summary

Nested Classes
interface CascadingSelectCFType.Visitor<T>  
Constants
String CHILD_KEY
[Expand]
Inherited Constants
From interface com.atlassian.jira.issue.customfields.CustomFieldType
Fields
public static final PersistenceFieldType CASCADE_VALUE_TYPE
public static final String PARENT_KEY
Public Constructors
CascadingSelectCFType(OptionsManager optionsManager, CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager, JiraBaseUrls jiraBaseUrls)
Public Methods
Object accept(VisitorBase visitor)
int compare(Map<StringOption> o1, Map<StringOption> o2, FieldConfig fieldConfig)
int compareOption(Option option1, Option option2)
void createValue(CustomField field, Issue issue, Map<StringOption> cascadingOptions)
Create a cascading select-list instance for an issue.
String getChangelogValue(CustomField field, Map<StringOption> cascadingOptions)
@Nonnull List<FieldConfigItemType> getConfigurationItemTypes()
Returns a List of FieldConfigItemType objects.
@Nullable Map<StringOption> getDefaultValue(FieldConfig fieldConfig)
Retrieves the Object representing the default CustomField value for the Custom Field.
FieldTypeInfo getFieldTypeInfo(FieldTypeInfoContext fieldTypeInfoContext)
Returns lower level Information about the field.
Set<Long> getIssueIdsWithValue(CustomField field, Option option)
Returns a list of Issue Ids matching the "value" note that the value in this instance is the single object
JsonData getJsonDefaultValue(IssueContext issueCtx, CustomField field)
Return The default data for this system 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 fieldConfig, 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.
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)
Object getStringValueFromCustomFieldParams(CustomFieldParams parameters)
Return the String value object from the CustomFieldParams.
Map<StringOption> getValueFromCustomFieldParams(CustomFieldParams relevantParams)
Retrieves the Transport Object representing the CustomField value instance from the CustomFieldParams of Strings.
Map<StringOption> getValueFromIssue(CustomField field, Issue issue)
Retrieves the Transport Object representing the current CustomField value for the given issue.
@Nonnull Map<StringObject> getVelocityParameters(Issue issue, CustomField field, FieldLayoutItem fieldLayoutItem)
The custom field may wish to pass parameters to the velocity context beyond the getValueFromIssue methods (eg managers).
Set<Long> remove(CustomField field)
Performs additional tasks when an entire CustomField of this type is being removed remove().
void removeValue(CustomField field, Issue issue, Option option)
Perform any actions required if the option selected by the issue is removed.
void setDefaultValue(FieldConfig fieldConfig, Map<StringOption> cascadingOptions)
void updateValue(CustomField field, Issue issue, Map<StringOption> cascadingOptions)
void validateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config)
Ensures that the CustomFieldParams of Strings is a valid representation of the Custom Field values.
[Expand]
Inherited Methods
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.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

Constants

public static final String CHILD_KEY

Constant Value: "1"

Fields

public static final PersistenceFieldType CASCADE_VALUE_TYPE

public static final String PARENT_KEY

Public Constructors

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

Public Methods

public Object accept (VisitorBase visitor)

public int compare (Map<StringOption> o1, Map<StringOption> o2, FieldConfig fieldConfig)

public int compareOption (Option option1, Option option2)

public void createValue (CustomField field, Issue issue, Map<StringOption> cascadingOptions)

Create a cascading select-list instance for an issue.

public String getChangelogValue (CustomField field, Map<StringOption> cascadingOptions)

@Nonnull public List<FieldConfigItemType> getConfigurationItemTypes ()

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

Returns

@Nullable public Map<StringOption> getDefaultValue (FieldConfig fieldConfig)

Retrieves the Object representing the default CustomField value for the Custom Field.

Parameters
fieldConfig CustomField for default value
Returns
  • Transport Object of the Default Value

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 list of Issue Ids matching the "value" note that the value in this instance is the single object

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)

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.
field the Custom Field
Returns
  • The default data for this system 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 fieldConfig, JiraContextNode jiraContextNode)

Returns all possible Options for this field.

Parameters
fieldConfig 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 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 Object getStringValueFromCustomFieldParams (CustomFieldParams parameters)

Return the String value object from the CustomFieldParams. The object may be a single String (e.g. TextCFType, List of Strings (e.g. MultiSelectCFType) or CustomFieldParams of Strings (e.g. CascadingSelectCFType). Among other things these values are passed to Velocity for rendering edit screens.

Parameters
parameters - CustomFieldParams containing String values
Returns
  • String value object from the CustomFieldParams

public Map<StringOption> getValueFromCustomFieldParams (CustomFieldParams relevantParams)

Retrieves the Transport Object representing the CustomField value instance from the CustomFieldParams of Strings.

Parameters
relevantParams CustomFieldParams of String objects. Will contain one value for Singular field types.
Returns

public Map<StringOption> getValueFromIssue (CustomField field, Issue issue)

Retrieves the Transport Object representing the current CustomField value for the given issue.

Parameters
field Custom field for which to retrieve the value
issue Issue from which to retrieve the value
Returns

@Nonnull public Map<StringObject> getVelocityParameters (Issue issue, CustomField field, FieldLayoutItem fieldLayoutItem)

The custom field may wish to pass parameters to the velocity context beyond the getValueFromIssue methods (eg managers).

The values are added to the context for all velocity views (edit, search, view, xml)

Parameters
issue The issue currently in context (Note: this will be null in cases like 'default value')
field CustomField
fieldLayoutItem FieldLayoutItem
Returns
  • A Map of parameters to add to the velocity context, or an empty Map otherwise (never null)

public Set<Long> remove (CustomField field)

Performs additional tasks when an entire CustomField of this type is being removed remove(). This includes removal of values & options.

Parameters
field The custom field that is being removed, so any data stored for any issues for that field can be deleted.
Returns
  • Set of issue ids that has been affected

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

Perform any actions required if the option selected by the issue is removed.

Parameters
field being edited
issue to remove stuff from
option option being removed.

public void setDefaultValue (FieldConfig fieldConfig, Map<StringOption> cascadingOptions)

public void updateValue (CustomField field, Issue issue, Map<StringOption> cascadingOptions)

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

Ensures that the CustomFieldParams of Strings is a valid representation of the Custom Field values. Any errors should be added to the ErrorCollection under the appropriate key as required.

Parameters
relevantParams parameter object of Strings
errorCollectionToAddTo errorCollection to which any erros should be added (never null)
config FieldConfig