Class AbstractMultiCFType<S>
- Type Parameters:
S
- Single object contained within the Collection Transport Object
- All Implemented Interfaces:
CustomFieldType<Collection<S>,
S>
- Direct Known Subclasses:
MultiGroupCFType
,MultiSelectCFType
,MultiUserCFType
,VersionCFType
Option
s - (MultiSelectCFType which lives in jira-core).
The Transport Object for this Custom Field type is a Collection of S, where S is defined by the subclass
Data is stored in the database a representations of a single S. E.g. A Custom Field that stores multiple Users,
will have each user saved seperately as an Object defined by convertTypeToDbValue(S)
See the javadoc of CustomFieldType.updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, Object)
,
CustomFieldType.createValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, Object)
, and
CustomFieldType.setDefaultValue(com.atlassian.jira.issue.fields.config.FieldConfig, Object)
for instance.
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
AbstractCustomFieldType.VisitorBase<X>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CustomFieldValuePersister
protected final GenericConfigManager
Fields inherited from interface com.atlassian.jira.issue.customfields.CustomFieldType
DEFAULT_VALUE_TYPE, RESOURCE_PREVIEW
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractMultiCFType
(CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected final Collection<S>
convertDbObjectToTypes
(Collection<Object> dbObjects) Converts a collection of objects representing the underlying type to a collection of underlying types.protected abstract S
convertDbValueToType
(Object dbValue) Converts a given db value to Single form of Transport Objectprotected final Collection<Object>
convertTypesToDbObjects
(Collection<S> typedList) Converts a collection of underlying types to a collection of db representations of underlying type.protected abstract Object
convertTypeToDbValue
(S value) Converts a given underlying type to its db storage value.void
createValue
(CustomField customField, Issue issue, Collection<S> value) Create a multi-select value for an issue.getChangelogValue
(CustomField field, Collection<S> values) Returns a string representation of the value if not null.protected abstract PersistenceFieldType
Type of database field needed to store this field.getDefaultValue
(FieldConfig fieldConfig) Retrieves the Object representing the default CustomField value for the Custom Field.protected abstract Comparator<S>
Returns a comparator for underlying type of this custom field.getValueFromIssue
(CustomField field, Issue issue) Retrieves the Transport Object representing the current CustomField value for the given issue.protected Collection<S>
getValueFromIssue
(CustomField field, Long issueId) remove
(CustomField field) called when removing a field.void
setDefaultValue
(FieldConfig fieldConfig, Collection<S> value) Sets the default value for a Custom Field.void
updateValue
(CustomField customField, Issue issue, Collection<S> value) Update a multi-select value for an issue.Methods inherited from class com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
assertObjectImplementsType, availableForBulkEdit, getChangelogString, getConfigurationItemTypes, getDescription, getDescriptor, getI18nBean, getKey, getName, getRelatedIndexers, getVelocityParameters, getVelocityParameters, init, isRenderable, valuesEqual
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.jira.issue.customfields.CustomFieldType
areAllRequiredParametersPresent, getCloneOptionConfiguration, getCloneValue, getNonNullCustomFieldProvider, getSingularObjectFromString, getStringFromSingularObject, getStringValueFromCustomFieldParams, getValueFromCustomFieldParams, isUserInputRequiredForMove, requiresAdditionalParams, validateFromParams
-
Field Details
-
customFieldValuePersister
-
genericConfigManager
-
-
Constructor Details
-
AbstractMultiCFType
protected AbstractMultiCFType(CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager)
-
-
Method Details
-
getTypeComparator
Returns a comparator for underlying type of this custom field. Used e.g. for sorting values retrieved from the Database- Returns:
- a comparator, null if can't be compared without extra context
-
convertTypeToDbValue
Converts a given underlying type to its db storage value. Must be compatable withPersistenceFieldType
returned bygetDatabaseType()
- Parameters:
value
- Single form of Transport Object- Returns:
- database representation of given Transport Object.
-
convertDbValueToType
Converts a given db value to Single form of Transport Object- Parameters:
dbValue
- db representation as returned byconvertTypeToDbValue(Object)
- Returns:
- Single form of Transport Object
-
getDatabaseType
Type of database field needed to store this field.- Returns:
- One of the predefined
PersistenceFieldType
types.
-
getDefaultValue
Description copied from interface:CustomFieldType
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
- See Also:
-
setDefaultValue
Sets the default value for a Custom Field.- Parameters:
fieldConfig
- CustomField for which the default is being storedvalue
- Transport Object representing the value instance of the CustomField.- See Also:
-
createValue
Create a multi-select value for an issue.- Parameters:
customField
-CustomField
for which the value is being storedissue
- TheIssue
.value
- Transport Object representing the value instance of the CustomField.- See Also:
-
updateValue
Update a multi-select value for an issue.- Parameters:
customField
-CustomField
for which the value is being storedissue
- TheIssue
.value
- Transport Object representing the value instance of the CustomField.- See Also:
-
getValueFromIssue
Description copied from interface:CustomFieldType
Retrieves the Transport Object representing the current CustomField value for the given issue.- Parameters:
field
- Custom field for which to retrieve the valueissue
- Issue from which to retrieve the value- Returns:
- Transport Object matching the Object parameter of
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)
- See Also:
-
getValueFromIssue
@Nullable protected Collection<S> getValueFromIssue(@Nonnull CustomField field, @Nullable Long issueId) -
getChangelogValue
Returns a string representation of the value if not null.- Parameters:
field
- not usedvalues
- value to create a change log for- Returns:
- string representaion of value if not null, empty string otherwise
-
convertTypesToDbObjects
Converts a collection of underlying types to a collection of db representations of underlying type.If a Collection of String is passed, then a new Collection is still created, containing the original String values.
- Parameters:
typedList
- a collection of underlying types- Returns:
- a collection of string representations of underlying type
-
convertDbObjectToTypes
Converts a collection of objects representing the underlying type to a collection of underlying types. Returns empty list when given strings collection is null.- Parameters:
dbObjects
- collection of db representations of types.- Returns:
- a collection of underlying types
-
remove
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)
-
accept
- Overrides:
accept
in classAbstractCustomFieldType<Collection<S>,
S>
-