@PublicSpi public abstract class

AbstractMultiCFType

extends AbstractCustomFieldType<T, S>
java.lang.Object
   ↳ com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType<T, S>
     ↳ com.atlassian.jira.issue.customfields.impl.AbstractMultiCFType<S>
Known Direct Subclasses

@PublicSpi

This class is designed for plugins to implement.

Clients of @PublicSpi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicSpi as per each product's API policy (clients should refer to each product's API policy for the exact guarantee -- usually binary compatibility is guaranteed at least across minor versions).

Note: @PublicSpi interfaces and classes are specifically designed to be implemented/extended by clients. Hence, the guarantee of binary compatibility is different to that of @PublicApi elements (if an element is both @PublicApi and @PublicSpi, both guarantees apply).

Class Overview

Abstract class for Multi-select Custom field types. Note that there is also another multi-select Custom Field for arbitrary Options - (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 updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, Object), createValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, Object), and setDefaultValue(com.atlassian.jira.issue.fields.config.FieldConfig, Object) for instance.

See Also

Summary

Nested Classes
interface AbstractMultiCFType.Visitor<X>  
[Expand]
Inherited Constants
From interface com.atlassian.jira.issue.customfields.CustomFieldType
Fields
protected final CustomFieldValuePersister customFieldValuePersister
protected final GenericConfigManager genericConfigManager
Protected Constructors
AbstractMultiCFType(CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager)
Public Methods
Object accept(VisitorBase visitor)
void createValue(CustomField customField, Issue issue, Collection<S> value)
Create a multi-select value for an issue.
String getChangelogValue(CustomField field, Collection<S> values)
Returns a string representation of the value if not null.
Collection<S> getDefaultValue(FieldConfig fieldConfig)
Collection<S> getValueFromIssue(CustomField field, Issue issue)
Set<Long> 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.
Protected Methods
final Collection<S> convertDbObjectToTypes(Collection<Object> dbObjects)
Converts a collection of objects representing the underlying type to a collection of underlying types.
@Nullable abstract S convertDbValueToType(Object dbValue)
Converts a given db value to Single form of Transport Object
@Nullable abstract Object convertTypeToDbValue(S value)
Converts a given underlying type to its db storage value.
final Collection<Object> convertTypesToDbObjects(Collection<S> typedList)
Converts a collection of underlying types to a collection of db representations of underlying type.
@Nonnull abstract PersistenceFieldType getDatabaseType()
Type of database field needed to store this field.
@Nullable abstract Comparator<S> getTypeComparator()
Returns a comparator for underlying type of this custom field.
[Expand]
Inherited Methods
From class com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
From class java.lang.Object
From interface com.atlassian.jira.issue.customfields.CustomFieldType

Fields

protected final CustomFieldValuePersister customFieldValuePersister

protected final GenericConfigManager genericConfigManager

Protected Constructors

protected AbstractMultiCFType (CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager)

Public Methods

public Object accept (VisitorBase visitor)

public void createValue (CustomField customField, Issue issue, Collection<S> value)

Create a multi-select value for an issue.

Parameters
customField CustomField for which the value is being stored
issue The Issue.
value Transport Object representing the value instance of the CustomField.

public String getChangelogValue (CustomField field, Collection<S> values)

Returns a string representation of the value if not null.

Parameters
field not used
values value to create a change log for
Returns
  • string representaion of value if not null, empty string otherwise

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 setDefaultValue (FieldConfig fieldConfig, Collection<S> value)

Sets the default value for a Custom Field.

Parameters
fieldConfig CustomField for which the default is being stored
value Transport Object representing the value instance of the CustomField.

public void updateValue (CustomField customField, Issue issue, Collection<S> value)

Update a multi-select value for an issue.

Parameters
customField CustomField for which the value is being stored
issue The Issue.
value Transport Object representing the value instance of the CustomField.

Protected Methods

protected final Collection<S> convertDbObjectToTypes (Collection<Object> dbObjects)

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

@Nullable protected abstract S convertDbValueToType (Object dbValue)

Converts a given db value to Single form of Transport Object

Parameters
dbValue db representation as returned by convertTypeToDbValue(Object)
Returns
  • Single form of Transport Object

@Nullable protected abstract Object convertTypeToDbValue (S value)

Converts a given underlying type to its db storage value. Must be compatable with PersistenceFieldType returned by getDatabaseType()

Parameters
value Single form of Transport Object
Returns
  • database representation of given Transport Object.

protected final Collection<Object> convertTypesToDbObjects (Collection<S> typedList)

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

@Nonnull protected abstract PersistenceFieldType getDatabaseType ()

Type of database field needed to store this field.

Returns

@Nullable protected abstract Comparator<S> 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