Class SelectCFType
java.lang.Object
com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType<T,T>
com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType<Option>
com.atlassian.jira.issue.customfields.impl.SelectCFType
- All Implemented Interfaces:
ProjectImportableCustomField,CustomFieldType<Option,,Option> GroupSelectorField,MultipleCustomFieldType<Option,,Option> MultipleSettableCustomFieldType<Option,,Option> SortableCustomField<String>,ExportableCustomFieldType,RestAwareCustomFieldType,RestCustomFieldTypeOperations
public class SelectCFType
extends AbstractSingleFieldType<Option>
implements MultipleSettableCustomFieldType<Option,Option>, SortableCustomField<String>, GroupSelectorField, ProjectImportableCustomField, RestAwareCustomFieldType, RestCustomFieldTypeOperations, ExportableCustomFieldType
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
AbstractCustomFieldType.VisitorBase<X> -
Field Summary
Fields inherited from class com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType
customFieldValuePersister, FIELD_TYPE_DATE, FIELD_TYPE_NUMBER, FIELD_TYPE_STRING, FIELD_TYPE_TEXT, genericConfigManagerFields inherited from interface com.atlassian.jira.issue.customfields.CustomFieldType
DEFAULT_VALUE_TYPE, RESOURCE_PREVIEW -
Constructor Summary
ConstructorsConstructorDescriptionSelectCFType(CustomFieldValuePersister customFieldValuePersister, OptionsManager optionsManager, GenericConfigManager genericConfigManager, JiraBaseUrls jiraBaseUrls) -
Method Summary
Modifier and TypeMethodDescriptionintcompare(String customFieldObjectValue1, String customFieldObjectValue2, FieldConfig fieldConfig) Compares the two custom field objects.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.Returns a List ofFieldConfigItemTypeobjects.protected PersistenceFieldTypeType of database field needed to store this field.protected ObjectgetDbValueFromObject(Option customFieldObject) Returns the database representation of the Java object as stored for that CustomField.getDefaultValue(FieldConfig fieldConfig) Retrieves the Object representing the default CustomField value for the Custom Field.getFieldTypeInfo(FieldTypeInfoContext fieldTypeInfoContext) Returns lower level Information about the field.getIdentifiersForGroup(String groupName) This method should be implemented in your custom type to return a List of identifiers of your group.getIssueIdsWithValue(CustomField field, Option option) Returns a Set of issue ids (Long) that have the given option selected.getJsonDefaultValue(IssueContext issueCtx, CustomField field) Return The default data for this system field.getJsonFromIssue(CustomField field, Issue issue, boolean renderedVersionRequested, FieldLayoutItem fieldLayoutItem) Return a JsonData representation of the field valuegetJsonSchema(CustomField customField) Return a description of the shape of this field when represented as JSON.Returns an instance ofNonNullCustomFieldProviderthat Jira will use to optimize indexing performance.protected OptiongetObjectFromDbValue(Object databaseValue) Returns the Transport Object for the given Custom Field value as represented by the value stored in the databasegetOptions(FieldConfig config) Returns all possible Options for this field.getOptions(FieldConfig config, JiraContextNode jiraContextNode) Returns all possible Options for this field.Returns the object that will perform the actual project import functions for the custom field type.getRepresentationFromIssue(Issue issue, CustomFieldExportContext context) Get the custom field representation of the issue, this object contains the column headers and values for each of theFieldExportPart.getRestFieldOperation(CustomField field) Returns the RestFieldOperationsHandler for this field.getSingularObjectFromString(String string) Returns a Singular Object, given the string value as passed by the presentation tier.getStringFromSingularObject(Option optionObject) Returns theStringrepresentation of a single value within the CustomFieldType.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).remove(CustomField field) called when removing a field.voidremoveValue(CustomField field, Issue issue, Option option) This default implementation will remove all values from the custom field for an issue.voidsetDefaultValue(FieldConfig fieldConfig, Option option) Sets the default value for a Custom FieldvoidvalidateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config) Ensures that theCustomFieldParamsof Strings is a valid representation of the Custom Field values.Methods inherited from class com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType
createValue, getChangelogValue, getStringValueFromCustomFieldParams, getValueFromCustomFieldParams, getValueFromIssue, getValueFromIssue, updateValueMethods inherited from class com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
assertObjectImplementsType, availableForBulkEdit, getDescription, getDescriptor, getI18nBean, getKey, getName, getRelatedIndexers, getVelocityParameters, init, isRenderable, valuesEqualMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.jira.issue.customfields.CustomFieldType
areAllRequiredParametersPresent, availableForBulkEdit, createValue, getChangelogValue, getCloneOptionConfiguration, getCloneValue, getDescription, getDescriptor, getKey, getName, getRelatedIndexers, getStringValueFromCustomFieldParams, getValueFromCustomFieldParams, getValueFromIssue, init, isRenderable, isUserInputRequiredForMove, requiresAdditionalParams, updateValue, valuesEqual
-
Constructor Details
-
SelectCFType
public SelectCFType(CustomFieldValuePersister customFieldValuePersister, OptionsManager optionsManager, GenericConfigManager genericConfigManager, JiraBaseUrls jiraBaseUrls)
-
-
Method Details
-
remove
Description copied from class:AbstractSingleFieldTypecalled 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)
- Specified by:
removein interfaceCustomFieldType<Option,Option> - Overrides:
removein classAbstractSingleFieldType<Option>- Parameters:
field- The custom field that is being removed, so any data stored for any issues for that field can be deleted.- Returns:
Set<Long>of issue ids that has been affected
-
getDatabaseType
Description copied from class:AbstractSingleFieldTypeType of database field needed to store this field.- Specified by:
getDatabaseTypein classAbstractSingleFieldType<Option>- Returns:
- One of the predefined
PersistenceFieldTypetypes.
-
getDbValueFromObject
Description copied from class:AbstractSingleFieldTypeReturns 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 byAbstractSingleFieldType.getDatabaseType()- Specified by:
getDbValueFromObjectin classAbstractSingleFieldType<Option>- Parameters:
customFieldObject- the Transport Object- Returns:
- String, Double or Date
-
getObjectFromDbValue
protected Option getObjectFromDbValue(@Nonnull Object databaseValue) throws FieldValidationException Description copied from class:AbstractSingleFieldTypeReturns the Transport Object for the given Custom Field value as represented by the value stored in the database- Specified by:
getObjectFromDbValuein classAbstractSingleFieldType<Option>- Parameters:
databaseValue- - String, Double or Date objects as returned fromAbstractSingleFieldType.getDbValueFromObject(Object)- Returns:
- Domain object or GenericValue
- Throws:
FieldValidationException- if field validation fails.
-
removeValue
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- Specified by:
removeValuein interfaceMultipleSettableCustomFieldType<Option,Option> - Parameters:
option- - ignoredfield- being editedissue- to remove stuff from
-
getSingularObjectFromString
Description copied from interface:CustomFieldTypeReturns 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.- Specified by:
getSingularObjectFromStringin interfaceCustomFieldType<Option,Option> - Parameters:
string- the String- Returns:
- singularObject instance
- Throws:
FieldValidationException- if the string is an invalid representation of the Object.
-
getStringFromSingularObject
Description copied from interface:CustomFieldTypeReturns theStringrepresentation 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 theCollectionorMap- Specified by:
getStringFromSingularObjectin interfaceCustomFieldType<Option,Option> - Parameters:
optionObject- the object- Returns:
- String representation of the Object
-
getIssueIdsWithValue
Description copied from interface:MultipleSettableCustomFieldTypeReturns a Set of issue ids (Long) that have the given option selected.- Specified by:
getIssueIdsWithValuein interfaceMultipleSettableCustomFieldType<Option,Option> - Parameters:
field- the CustomField to search onoption- the Object representing a single value to search on.- Returns:
- Set of Longs
-
getConfigurationItemTypes
Description copied from interface:CustomFieldTypeReturns a List ofFieldConfigItemTypeobjects. Can not be immutable. This opens up possibilities for configurable custom fields.- Specified by:
getConfigurationItemTypesin interfaceCustomFieldType<Option,Option> - Overrides:
getConfigurationItemTypesin classAbstractCustomFieldType<Option,Option> - Returns:
- List of
FieldConfigItemType
-
validateFromParams
public void validateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config) Description copied from interface:CustomFieldTypeEnsures that theCustomFieldParamsof Strings is a valid representation of the Custom Field values. Any errors should be added to theErrorCollectionunder the appropriate key as required.- Specified by:
validateFromParamsin interfaceCustomFieldType<Option,Option> - Overrides:
validateFromParamsin classAbstractSingleFieldType<Option>- Parameters:
relevantParams- parameter object of StringserrorCollectionToAddTo- errorCollection to which any errors should be added (never null)config- FieldConfig
-
setDefaultValue
Description copied from interface:CustomFieldTypeSets the default value for a Custom Field- Specified by:
setDefaultValuein interfaceCustomFieldType<Option,Option> - Overrides:
setDefaultValuein classAbstractSingleFieldType<Option>- Parameters:
fieldConfig- CustomField for which the default is being storedoption- Transport Object representing the value instance of the CustomField
-
getDefaultValue
Description copied from interface:CustomFieldTypeRetrieves the Object representing the default CustomField value for the Custom Field.- Specified by:
getDefaultValuein interfaceCustomFieldType<Option,Option> - Overrides:
getDefaultValuein classAbstractSingleFieldType<Option>- Parameters:
fieldConfig- CustomField for default value- Returns:
- Transport Object of the Default Value
-
getChangelogString
Description copied from interface:CustomFieldTypeReturns 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.- Specified by:
getChangelogStringin interfaceCustomFieldType<Option,Option> - Overrides:
getChangelogStringin classAbstractCustomFieldType<Option,Option> - Parameters:
field- CustomField that the value belongs tovalue- Transport Object representing the value instance of the CustomField- Returns:
- Change log string.
-
getVelocityParameters
@Nonnull public Map<String,Object> getVelocityParameters(@Nullable Issue issue, CustomField field, FieldLayoutItem fieldLayoutItem) Description copied from interface:CustomFieldTypeThe 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)
- Specified by:
getVelocityParametersin interfaceCustomFieldType<Option,Option> - Overrides:
getVelocityParametersin classAbstractCustomFieldType<Option,Option> - Parameters:
issue- The issue currently in context (Note: this will be null in cases like 'default value')field- CustomFieldfieldLayoutItem- FieldLayoutItem- Returns:
- A
Mapof parameters to add to the velocity context, or an empty Map otherwise (never null)
-
getOptions
Description copied from interface:MultipleCustomFieldTypeReturns all possible Options for this field.- Specified by:
getOptionsin interfaceMultipleCustomFieldType<Option,Option> - Parameters:
config- configuration for this fieldjiraContextNode- context (not used in any of the current implementations)- Returns:
- all possible Options for this field.
-
getOptions
Description copied from interface:MultipleCustomFieldTypeReturns all possible Options for this field.- Specified by:
getOptionsin interfaceMultipleCustomFieldType<Option,Option> - Parameters:
config- configuration for this field- Returns:
- all possible Options for this field.
-
compare
public int compare(@Nonnull String customFieldObjectValue1, @Nonnull String customFieldObjectValue2, FieldConfig fieldConfig) Description copied from interface:SortableCustomFieldCompares the two custom field objects.- Specified by:
comparein interfaceSortableCustomField<String>- Parameters:
customFieldObjectValue1- Never nullcustomFieldObjectValue2- Never null- Returns:
- 0, 1 or -1
-
getProjectImporter
Description copied from interface:ProjectImportableCustomFieldReturns the object that will perform the actual project import functions for the custom field type.- Specified by:
getProjectImporterin interfaceProjectImportableCustomField- Returns:
- the object that will perform the actual project import functions for the custom field type.
-
accept
- Overrides:
acceptin classAbstractSingleFieldType<Option>
-
getIdentifiersForGroup
Description copied from interface:GroupSelectorFieldThis method should be implemented in your custom type to return a List of identifiers of your group. Usually the identifier is just thegroupName. However, some custom fields, such asSelectCFTypeassign ids to their values and index the ids. In such a case, the custom field should return all the ids under which thegroupNamewas indexed. These should match the values that were used in the implementation ofFieldIndexer.addIndex(Document, Issue, CustomFieldPrefetchedData)- Specified by:
getIdentifiersForGroupin interfaceGroupSelectorField- Parameters:
groupName- The name of the group- Returns:
- The group identifier that will be used to search for this group in the index
-
getRepresentationFromIssue
Description copied from interface:ExportableCustomFieldTypeGet the custom field representation of the issue, this object contains the column headers and values for each of theFieldExportPart.- Specified by:
getRepresentationFromIssuein interfaceExportableCustomFieldType- Parameters:
issue- to get the representation forcontext- which contains information such as the i18nHelper and field- Returns:
- the exportable parts of this issue
-
getNonNullCustomFieldProvider
Description copied from interface:CustomFieldTypeReturns an instance ofNonNullCustomFieldProviderthat Jira will use to optimize indexing performance.- Specified by:
getNonNullCustomFieldProviderin interfaceCustomFieldType<Option,Option>
-
getFieldTypeInfo
Description copied from interface:RestAwareCustomFieldTypeReturns lower level Information about the field. This information contains allowed values and/or the autocomplete url- Specified by:
getFieldTypeInfoin interfaceRestAwareCustomFieldType- Parameters:
fieldTypeInfoContext- context information for generating theFieldTypeInfo.- Returns:
- Low level information about the field.
-
getJsonSchema
Description copied from interface:RestAwareCustomFieldTypeReturn a description of the shape of this field when represented as JSON.- Specified by:
getJsonSchemain interfaceRestAwareCustomFieldType
-
getJsonFromIssue
public FieldJsonRepresentation getJsonFromIssue(CustomField field, Issue issue, boolean renderedVersionRequested, @Nullable FieldLayoutItem fieldLayoutItem) Description copied from interface:RestAwareCustomFieldTypeReturn a JsonData representation of the field value- Specified by:
getJsonFromIssuein interfaceRestAwareCustomFieldType- Parameters:
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.- 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.
-
getRestFieldOperation
Description copied from interface:RestCustomFieldTypeOperationsReturns the RestFieldOperationsHandler for this field.- Specified by:
getRestFieldOperationin interfaceRestCustomFieldTypeOperations- Parameters:
field- the Custom Field- Returns:
- the RestFieldOperationsHandler for this field.
-
getJsonDefaultValue
Description copied from interface:RestCustomFieldTypeOperationsReturn The default data for this system field. May be null if there is no default.- Specified by:
getJsonDefaultValuein interfaceRestCustomFieldTypeOperations- Overrides:
getJsonDefaultValuein classAbstractSingleFieldType<Option>- 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.
-