public class CascadingSelectCFType extends AbstractCustomFieldType<Map<String,Option>,Option> implements MultipleSettableCustomFieldType<Map<String,Option>,Option>, SortableCustomField<Map<String,Option>>, ProjectImportableCustomField, RestAwareCustomFieldType, RestCustomFieldTypeOperations, ExportableCustomFieldType
Cascading Select Custom Field Type allows for multiple dependent select lists.
Modifier and Type | Class and Description |
---|---|
static interface |
CascadingSelectCFType.Visitor<T> |
AbstractCustomFieldType.VisitorBase<X>
Modifier and Type | Field and Description |
---|---|
static PersistenceFieldType |
CASCADE_VALUE_TYPE |
static String |
CHILD_KEY |
static String |
HIERARCHY_SEPARATOR |
static String |
PARENT_KEY |
DEFAULT_VALUE_TYPE, RESOURCE_PREVIEW
Constructor and Description |
---|
CascadingSelectCFType(OptionsManager optionsManager,
CustomFieldValuePersister customFieldValuePersister,
GenericConfigManager genericConfigManager,
JiraBaseUrls jiraBaseUrls) |
Modifier and Type | Method and Description |
---|---|
Object |
accept(AbstractCustomFieldType.VisitorBase visitor) |
boolean |
areAllRequiredParametersPresent(Map<String,Object> params,
String customFieldId)
This method validates if all the obligatory parameters of a given custom field type have been set when the custom field
is set to be required.
|
int |
compare(Map<String,Option> o1,
Map<String,Option> o2,
FieldConfig fieldConfig)
Compares the two custom field objects.
|
int |
compareOption(Option option1,
Option option2) |
void |
createValue(CustomField field,
Issue issue,
Map<String,Option> cascadingOptions)
Create a cascading select-list instance for an issue.
|
String |
getChangelogValue(CustomField field,
Map<String,Option> cascadingOptions)
Returns a values to be stored in the change log, example is the id of the changed item.
|
List<FieldConfigItemType> |
getConfigurationItemTypes()
Returns a List of
FieldConfigItemType objects. |
Map<String,Option> |
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.
|
NonNullCustomFieldProvider |
getNonNullCustomFieldProvider()
Returns an instance of
NonNullCustomFieldProvider that Jira will use to optimize indexing performance. |
Options |
getOptions(FieldConfig fieldConfig)
Returns all possible Options for this field.
|
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.
|
FieldExportParts |
getRepresentationFromIssue(Issue issue,
CustomFieldExportContext context)
Get the custom field representation of the issue, this object contains the column headers and values for each
of the
FieldExportPart . |
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)
Returns the
String representation of a single value within the CustomFieldType. |
Object |
getStringValueFromCustomFieldParams(CustomFieldParams parameters)
Return the String value object from the CustomFieldParams.
|
Map<String,Option> |
getValueFromCustomFieldParams(CustomFieldParams relevantParams)
Retrieves the Transport Object representing the CustomField value instance from the CustomFieldParams of Strings.
|
Map<String,Option> |
getValueFromIssue(CustomField field,
Issue issue)
Retrieves the Transport Object representing the current CustomField value for the given issue.
|
Map<String,Object> |
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
CustomField.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<String,Option> cascadingOptions)
Sets the default value for a Custom Field
|
void |
updateValue(CustomField field,
Issue issue,
Map<String,Option> cascadingOptions)
Update the value for this Custom Field in a particular issue currently stored in the database.
|
void |
validateFromParams(CustomFieldParams relevantParams,
ErrorCollection errorCollectionToAddTo,
FieldConfig config)
Ensures that the
CustomFieldParams of Strings is a valid representation of the Custom Field values. |
assertObjectImplementsType, availableForBulkEdit, getChangelogString, getDescription, getDescriptor, getI18nBean, getKey, getName, getRelatedIndexers, getVelocityParameters, init, isRenderable, valuesEqual
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
availableForBulkEdit, getChangelogString, getCloneOptionConfiguration, getCloneValue, getDescription, getDescriptor, getKey, getName, getNonnullCustomFieldProvider, getRelatedIndexers, init, isRenderable, isUserInputRequiredForMove, valuesEqual
public static final String PARENT_KEY
public static final String CHILD_KEY
public static final String HIERARCHY_SEPARATOR
public static final PersistenceFieldType CASCADE_VALUE_TYPE
public CascadingSelectCFType(OptionsManager optionsManager, CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager, JiraBaseUrls jiraBaseUrls)
public void removeValue(CustomField field, Issue issue, Option option)
MultipleSettableCustomFieldType
removeValue
in interface MultipleSettableCustomFieldType<Map<String,Option>,Option>
field
- being editedissue
- to remove stuff fromoption
- option being removed.public Set<Long> remove(CustomField field)
CustomFieldType
CustomField.remove()
.
This includes removal of values & options.public Options getOptions(FieldConfig fieldConfig, JiraContextNode jiraContextNode)
MultipleCustomFieldType
getOptions
in interface MultipleCustomFieldType<Map<String,Option>,Option>
fieldConfig
- configuration for this fieldjiraContextNode
- context (not used in any of the current implementations)public Options getOptions(FieldConfig fieldConfig)
MultipleCustomFieldType
getOptions
in interface MultipleCustomFieldType<Map<String,Option>,Option>
fieldConfig
- configuration for this fieldpublic Set<Long> getIssueIdsWithValue(CustomField field, Option option)
getIssueIdsWithValue
in interface MultipleSettableCustomFieldType<Map<String,Option>,Option>
field
- the CustomField to search onoption
- the Object representing a single value to search on.public void validateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config)
CustomFieldType
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.validateFromParams
in interface CustomFieldType<Map<String,Option>,Option>
relevantParams
- parameter object of StringserrorCollectionToAddTo
- errorCollection to which any errors should be added (never null)config
- FieldConfigpublic boolean areAllRequiredParametersPresent(Map<String,Object> params, String customFieldId)
CustomFieldType
areAllRequiredParametersPresent
in interface CustomFieldType<Map<String,Option>,Option>
params
- A map of parameters attached to an issue create/edit action.customFieldId
- An ID of a custom field which is being validated e.g. "customfield_10101".public void createValue(CustomField field, Issue issue, @Nonnull Map<String,Option> cascadingOptions)
createValue
in interface CustomFieldType<Map<String,Option>,Option>
cascadingOptions
- field
- CustomField
for which the value is being storedissue
- The Issue
to be stored against.public void updateValue(CustomField field, Issue issue, Map<String,Option> cascadingOptions)
CustomFieldType
updateValue
in interface CustomFieldType<Map<String,Option>,Option>
field
- CustomField
for which the value is being storedissue
- The Issue
to be stored against.cascadingOptions
- Transport Object representing the value instance of the CustomField.@Nullable public Map<String,Option> getValueFromIssue(CustomField field, Issue issue)
CustomFieldType
getValueFromIssue
in interface CustomFieldType<Map<String,Option>,Option>
field
- Custom field for which to retrieve the valueissue
- Issue from which to retrieve the valueCustomFieldType.createValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, T)
, CustomFieldType.updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, T)
public Map<String,Option> getValueFromCustomFieldParams(CustomFieldParams relevantParams) throws FieldValidationException
CustomFieldType
getValueFromCustomFieldParams
in interface CustomFieldType<Map<String,Option>,Option>
relevantParams
- CustomFieldParams of String objects. Will contain one value for Singular field types.CustomFieldType.createValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, T)
, CustomFieldType.updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, T)
FieldValidationException
- if the String value fails to convert into ObjectsCustomFieldType.createValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, Object)
,
CustomFieldType.updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, Object)
,
CustomFieldType.getValueFromIssue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue)
public Object getStringValueFromCustomFieldParams(CustomFieldParams parameters)
CustomFieldType
getStringValueFromCustomFieldParams
in interface CustomFieldType<Map<String,Option>,Option>
parameters
- - CustomFieldParams containing String values@Nullable public Map<String,Option> getDefaultValue(FieldConfig fieldConfig)
CustomFieldType
getDefaultValue
in interface CustomFieldType<Map<String,Option>,Option>
fieldConfig
- CustomField for default valuepublic void setDefaultValue(FieldConfig fieldConfig, Map<String,Option> cascadingOptions)
CustomFieldType
setDefaultValue
in interface CustomFieldType<Map<String,Option>,Option>
fieldConfig
- CustomField for which the default is being storedcascadingOptions
- Transport Object representing the value instance of the CustomFieldpublic String getChangelogValue(CustomField field, Map<String,Option> cascadingOptions)
CustomFieldType
getChangelogValue
in interface CustomFieldType<Map<String,Option>,Option>
field
- CustomField that the value belongs tocascadingOptions
- Transport Object representing the value instance of the CustomFieldpublic String getStringFromSingularObject(Option optionObject)
CustomFieldType
String
representation of a single value within the CustomFieldType. This is the value that
is passed to the presentation tier for editing. For single CustomFieldTypes the Singular Object is
the same as a Transport Object. However, for multi-dimensional CustomFieldTypes, the Singular Object is
the Object contained within the Collection
or Map
getStringFromSingularObject
in interface CustomFieldType<Map<String,Option>,Option>
optionObject
- the objectpublic Option getSingularObjectFromString(String string) throws FieldValidationException
CustomFieldType
getSingularObjectFromString
in interface CustomFieldType<Map<String,Option>,Option>
string
- the StringFieldValidationException
- if the string is an invalid representation of the Object.@Nonnull public List<FieldConfigItemType> getConfigurationItemTypes()
CustomFieldType
FieldConfigItemType
objects. Can not be immutable.
This opens up possibilities for configurable custom fields.getConfigurationItemTypes
in interface CustomFieldType<Map<String,Option>,Option>
getConfigurationItemTypes
in class AbstractCustomFieldType<Map<String,Option>,Option>
FieldConfigItemType
@Nonnull public Map<String,Object> getVelocityParameters(@Nullable Issue issue, CustomField field, FieldLayoutItem fieldLayoutItem)
CustomFieldType
The values are added to the context for all velocity views (edit, search, view, xml)
getVelocityParameters
in interface CustomFieldType<Map<String,Option>,Option>
getVelocityParameters
in class AbstractCustomFieldType<Map<String,Option>,Option>
issue
- The issue currently in context (Note: this will be null in cases like 'default value')field
- CustomFieldfieldLayoutItem
- FieldLayoutItemMap
of parameters to add to the velocity context, or an empty Map otherwise (never null)public int compare(@Nonnull Map<String,Option> o1, @Nonnull Map<String,Option> o2, FieldConfig fieldConfig)
SortableCustomField
compare
in interface SortableCustomField<Map<String,Option>>
o1
- Never nullo2
- Never nullpublic ProjectCustomFieldImporter getProjectImporter()
ProjectImportableCustomField
getProjectImporter
in interface ProjectImportableCustomField
public Object accept(AbstractCustomFieldType.VisitorBase visitor)
public FieldExportParts getRepresentationFromIssue(Issue issue, CustomFieldExportContext context)
ExportableCustomFieldType
FieldExportPart
.getRepresentationFromIssue
in interface ExportableCustomFieldType
issue
- to get the representation forcontext
- which contains information such as the i18nHelper and fieldpublic NonNullCustomFieldProvider getNonNullCustomFieldProvider()
CustomFieldType
NonNullCustomFieldProvider
that Jira will use to optimize indexing performance.getNonNullCustomFieldProvider
in interface CustomFieldType<Map<String,Option>,Option>
public FieldTypeInfo getFieldTypeInfo(FieldTypeInfoContext fieldTypeInfoContext)
RestAwareCustomFieldType
getFieldTypeInfo
in interface RestAwareCustomFieldType
fieldTypeInfoContext
- context information for generating the FieldTypeInfo
.public JsonType getJsonSchema(CustomField customField)
RestAwareCustomFieldType
getJsonSchema
in interface RestAwareCustomFieldType
public FieldJsonRepresentation getJsonFromIssue(CustomField field, Issue issue, boolean renderedVersionRequested, @Nullable FieldLayoutItem fieldLayoutItem)
RestAwareCustomFieldType
getJsonFromIssue
in interface RestAwareCustomFieldType
field
- configuration of the current fieldissue
- to get field data fromrenderedVersionRequested
- whether the use requested the return of rendered/pretty data as well as raw datafieldLayoutItem
- field layout for this field.public RestFieldOperationsHandler getRestFieldOperation(CustomField field)
RestCustomFieldTypeOperations
getRestFieldOperation
in interface RestCustomFieldTypeOperations
field
- the Custom Fieldpublic JsonData getJsonDefaultValue(IssueContext issueCtx, CustomField field)
RestCustomFieldTypeOperations
getJsonDefaultValue
in interface RestCustomFieldTypeOperations
issueCtx
- Issue (This should really only need to be an issue context, but for historical reasons we need an issue object.field
- the Custom FieldCopyright © 2002-2024 Atlassian. All Rights Reserved.