S
- Single object contained within the Collection Transport Object@PublicSpi public abstract class AbstractMultiCFType<S> extends AbstractCustomFieldType<Collection<S>,S>
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.
CustomFieldType
Modifier and Type | Class and Description |
---|---|
static interface |
AbstractMultiCFType.Visitor<X> |
AbstractCustomFieldType.VisitorBase<X>
Modifier and Type | Field and Description |
---|---|
protected CustomFieldValuePersister |
customFieldValuePersister |
protected GenericConfigManager |
genericConfigManager |
DEFAULT_VALUE_TYPE, RESOURCE_PREVIEW
Modifier | Constructor and Description |
---|---|
protected |
AbstractMultiCFType(CustomFieldValuePersister customFieldValuePersister,
GenericConfigManager genericConfigManager) |
Modifier and Type | Method and Description |
---|---|
Object |
accept(AbstractCustomFieldType.VisitorBase visitor) |
protected 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 Object
|
protected 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.
|
String |
getChangelogValue(CustomField field,
Collection<S> values)
Returns a string representation of the value if not null.
|
protected abstract PersistenceFieldType |
getDatabaseType()
Type of database field needed to store this field.
|
Collection<S> |
getDefaultValue(FieldConfig fieldConfig)
Retrieves the Object representing the default CustomField value for the Custom Field.
|
protected abstract Comparator<S> |
getTypeComparator()
Returns a comparator for underlying type of this custom field.
|
Collection<S> |
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) |
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.
|
assertObjectImplementsType, availableForBulkEdit, getChangelogString, getConfigurationItemTypes, getDescription, getDescriptor, getI18nBean, getKey, getName, getRelatedIndexers, getVelocityParameters, getVelocityParameters, init, isRenderable, valuesEqual
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCloneOptionConfiguration, getCloneValue, getNonnullCustomFieldProvider, getNonNullCustomFieldProvider, getSingularObjectFromString, getStringFromSingularObject, getStringValueFromCustomFieldParams, getValueFromCustomFieldParams, isUserInputRequiredForMove, validateFromParams
protected final CustomFieldValuePersister customFieldValuePersister
protected final GenericConfigManager genericConfigManager
protected AbstractMultiCFType(CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager)
@Nullable protected abstract Comparator<S> getTypeComparator()
@Nullable protected abstract Object convertTypeToDbValue(@Nullable S value)
PersistenceFieldType
returned by getDatabaseType()
value
- Single form of Transport Object@Nullable protected abstract S convertDbValueToType(@Nullable Object dbValue)
dbValue
- db representation as returned by convertTypeToDbValue(Object)
@Nonnull protected abstract PersistenceFieldType getDatabaseType()
PersistenceFieldType
types.public Collection<S> getDefaultValue(FieldConfig fieldConfig)
CustomFieldType
fieldConfig
- CustomField for default valueCustomFieldType.getDefaultValue(com.atlassian.jira.issue.fields.config.FieldConfig)
public void setDefaultValue(FieldConfig fieldConfig, Collection<S> value)
fieldConfig
- CustomField for which the default is being storedvalue
- Transport Object representing the value instance of the CustomField.CustomFieldType.setDefaultValue(com.atlassian.jira.issue.fields.config.FieldConfig, Object)
public void createValue(CustomField customField, Issue issue, @Nonnull Collection<S> value)
customField
- CustomField
for which the value is being storedissue
- The Issue
.value
- Transport Object representing the value instance of the CustomField.CustomFieldType.createValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, Object)
public void updateValue(CustomField customField, Issue issue, Collection<S> value)
customField
- CustomField
for which the value is being storedissue
- The Issue
.value
- Transport Object representing the value instance of the CustomField.CustomFieldType.updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, Object)
@Nullable public Collection<S> getValueFromIssue(@Nonnull CustomField field, @Nonnull Issue issue)
CustomFieldType
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)
CustomFieldType.getValueFromIssue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue)
@Nullable protected Collection<S> getValueFromIssue(@Nonnull CustomField field, @Nullable Long issueId)
public String getChangelogValue(CustomField field, Collection<S> values)
field
- not usedvalues
- value to create a change log forprotected final Collection<Object> convertTypesToDbObjects(Collection<S> typedList)
If a Collection of String is passed, then a new Collection is still created, containing the original String values.
typedList
- a collection of underlying typesprotected final Collection<S> convertDbObjectToTypes(Collection<Object> dbObjects)
dbObjects
- collection of db representations of types.public Set<Long> remove(CustomField field)
Subclasses should override this if they have specific cleanup that they need to do (such as removing select list values)
field
- The custom field that is being removed, so any data stored for
any issues for that field can be deleted.Set
of issue ids that has been affectedpublic Object accept(AbstractCustomFieldType.VisitorBase visitor)
accept
in class AbstractCustomFieldType<Collection<S>,S>
Copyright © 2002-2022 Atlassian. All Rights Reserved.