public class VersionCFType extends AbstractMultiCFType<Version> implements RequiresProjectSelectedMarker, SortableCustomField, ProjectImportableCustomField, RestAwareCustomFieldType, RestCustomFieldTypeOperations, ExportableCustomFieldType
Version
s.
Collection
of Version
sVersion
Long
of the Version's idModifier and Type | Class and Description |
---|---|
static class |
VersionCFType.VersionOrder
An enum representing orders can be choosed to affect the order of versions group displayed on version picker custom field
|
static interface |
VersionCFType.Visitor<X> |
AbstractCustomFieldType.VisitorBase<X>
Modifier and Type | Field and Description |
---|---|
static String |
MULTIPLE_VERSION_TYPE |
static String |
SINGLE_VERSION_TYPE |
customFieldValuePersister
DEFAULT_VALUE_TYPE, RESOURCE_PREVIEW
Constructor and Description |
---|
VersionCFType(PermissionManager permissionManager,
JiraAuthenticationContext jiraAuthenticationContext,
VersionManager versionManager,
CustomFieldValuePersister customFieldValuePersister,
GenericConfigManager genericConfigManager,
VersionHelperBean versionHelperBean,
JiraBaseUrls jiraBaseUrls) |
Modifier and Type | Method and Description |
---|---|
Object |
accept(AbstractCustomFieldType.VisitorBase visitor) |
String |
availableForBulkEdit(BulkEditBean bulkEditBean)
Allow the custom field type perform a specific check as to its availability for bulk editing.
|
int |
compare(Object customFieldObjectValue1,
Object customFieldObjectValue2,
FieldConfig fieldConfig)
Compares the two custom field objects.
|
protected Version |
convertDbValueToType(Object input)
Converts a given db value to Single form of Transport Object
|
protected Object |
convertTypeToDbValue(Version value)
Converts a given underlying type to its db storage value.
|
String |
getChangelogString(CustomField field,
Collection<Version> versions)
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.
|
List<FieldConfigItemType> |
getConfigurationItemTypes()
Returns a List of
FieldConfigItemType objects. |
protected PersistenceFieldType |
getDatabaseType()
Type of database field needed to store this field.
|
FieldTypeInfo |
getFieldTypeInfo(FieldTypeInfoContext fieldTypeInfoContext)
Returns lower level Information about the field.
|
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.
|
ProjectCustomFieldImporter |
getProjectImporter()
Returns the object that will perform the actual project import functions for the custom field type.
|
FieldExportParts |
getRepresentationFromIssue(Issue issue,
CustomFieldExportContext context)
Generates a multi column representation for all the versions in this issue.
|
RestFieldOperationsHandler |
getRestFieldOperation(CustomField field)
Returns the RestFieldOperationsHandler for this field.
|
Version |
getSingularObjectFromString(String string)
Returns a Singular Object, given the string value as passed by the presentation tier.
|
String |
getStringFromSingularObject(Version version)
Returns the
String representation of a single value within the CustomFieldType. |
Object |
getStringValueFromCustomFieldParams(CustomFieldParams parameters)
Return the String value object from the CustomFieldParams.
|
protected Comparator<Version> |
getTypeComparator()
Returns a comparator for underlying type of this custom field.
|
Collection<Version> |
getValueFromCustomFieldParams(CustomFieldParams parameters)
Retrieves the Transport Object representing the CustomField value instance from the CustomFieldParams of Strings.
|
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).
|
boolean |
isMultiple() |
void |
validateFromParams(CustomFieldParams relevantParams,
ErrorCollection errorCollectionToAddTo,
FieldConfig config)
Ensures that the
CustomFieldParams of Strings is a valid representation of the Custom Field values. |
convertDbObjectToTypes, convertTypesToDbObjects, createValue, getChangelogValue, getDefaultValue, getValueFromIssue, remove, setDefaultValue, updateValue
assertObjectImplementsType, getDescription, getDescriptor, getI18nBean, getKey, getName, getRelatedIndexers, getVelocityParameters, init, isRenderable, valuesEqual
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCloneOptionConfiguration, getCloneValue, isUserInputRequiredForMove
public static final String SINGLE_VERSION_TYPE
public static final String MULTIPLE_VERSION_TYPE
public VersionCFType(PermissionManager permissionManager, JiraAuthenticationContext jiraAuthenticationContext, VersionManager versionManager, CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager, VersionHelperBean versionHelperBean, JiraBaseUrls jiraBaseUrls)
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<Collection<Version>,Version>
relevantParams
- parameter object of StringserrorCollectionToAddTo
- errorCollection to which any errors should be added (never null)config
- FieldConfigpublic Collection<Version> getValueFromCustomFieldParams(CustomFieldParams parameters) throws FieldValidationException
CustomFieldType
getValueFromCustomFieldParams
in interface CustomFieldType<Collection<Version>,Version>
parameters
- 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<Collection<Version>,Version>
parameters
- - CustomFieldParams containing String valuespublic String getChangelogString(CustomField field, Collection<Version> versions)
CustomFieldType
getChangelogString
in interface CustomFieldType<Collection<Version>,Version>
getChangelogString
in class AbstractCustomFieldType<Collection<Version>,Version>
field
- CustomField that the value belongs toversions
- Transport Object representing the value instance of the CustomFieldpublic String getStringFromSingularObject(Version version)
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<Collection<Version>,Version>
version
- the objectpublic Version getSingularObjectFromString(String string) throws FieldValidationException
CustomFieldType
getSingularObjectFromString
in interface CustomFieldType<Collection<Version>,Version>
string
- the StringFieldValidationException
- if the string is an invalid representation of the Object.public int compare(@Nonnull Object customFieldObjectValue1, @Nonnull Object customFieldObjectValue2, FieldConfig fieldConfig)
SortableCustomField
compare
in interface SortableCustomField
customFieldObjectValue1
- Never nullcustomFieldObjectValue2
- Never null@Nonnull public List<FieldConfigItemType> getConfigurationItemTypes()
CustomFieldType
FieldConfigItemType
objects. Can not be immutable.
This opens up possibilities for configurable custom fields.getConfigurationItemTypes
in interface CustomFieldType<Collection<Version>,Version>
getConfigurationItemTypes
in class AbstractCustomFieldType<Collection<Version>,Version>
FieldConfigItemType
public String availableForBulkEdit(BulkEditBean bulkEditBean)
CustomFieldType
availableForBulkEdit
in interface CustomFieldType<Collection<Version>,Version>
availableForBulkEdit
in class AbstractCustomFieldType<Collection<Version>,Version>
bulkEditBean
- BulkEditBean@Nonnull public Map<String,Object> getVelocityParameters(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<Collection<Version>,Version>
getVelocityParameters
in class AbstractCustomFieldType<Collection<Version>,Version>
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 ProjectCustomFieldImporter getProjectImporter()
ProjectImportableCustomField
getProjectImporter
in interface ProjectImportableCustomField
public boolean isMultiple()
protected Comparator<Version> getTypeComparator()
AbstractMultiCFType
getTypeComparator
in class AbstractMultiCFType<Version>
protected Object convertTypeToDbValue(Version value)
AbstractMultiCFType
PersistenceFieldType
returned by AbstractMultiCFType.getDatabaseType()
convertTypeToDbValue
in class AbstractMultiCFType<Version>
value
- Single form of Transport Objectprotected Version convertDbValueToType(Object input)
AbstractMultiCFType
convertDbValueToType
in class AbstractMultiCFType<Version>
input
- db representation as returned by AbstractMultiCFType.convertTypeToDbValue(Object)
@Nonnull protected PersistenceFieldType getDatabaseType()
AbstractMultiCFType
getDatabaseType
in class AbstractMultiCFType<Version>
PersistenceFieldType
types.public Object accept(AbstractCustomFieldType.VisitorBase visitor)
accept
in class AbstractMultiCFType<Version>
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 Fieldpublic FieldExportParts getRepresentationFromIssue(Issue issue, CustomFieldExportContext context)
getRepresentationFromIssue
in interface ExportableCustomFieldType
issue
- to get the representation forcontext
- which contains information such as the i18nHelper and fieldpublic 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.Copyright © 2002-2017 Atlassian. All Rights Reserved.