public class LabelsCFType extends AbstractCustomFieldType<Set<Label>,Label> implements SortableCustomField<Set<Label>>, ProjectImportableCustomFieldParser, ProjectImportableCustomField, RestAwareCustomFieldType, RestCustomFieldTypeOperations, ExportableCustomFieldType
Modifier and Type | Class and Description |
---|---|
static interface |
LabelsCFType.Visitor<T> |
AbstractCustomFieldType.VisitorBase<X>
CUSTOM_FIELD_VALUE_ENTITY_NAME
DEFAULT_VALUE_TYPE, RESOURCE_PREVIEW
Constructor and Description |
---|
LabelsCFType(JiraAuthenticationContext authenticationContext,
IssueManager issueManager,
GenericConfigManager genericConfigManager,
LabelUtil labelUtil,
LabelManager labelManager,
ProjectImportLabelFieldParser projectImportableCustomFieldParser,
JiraBaseUrls jiraBaseUrls) |
Modifier and Type | Method and Description |
---|---|
Object |
accept(AbstractCustomFieldType.VisitorBase visitor) |
int |
compare(Set<Label> customFieldObjectValue1,
Set<Label> customFieldObjectValue2,
FieldConfig fieldConfig)
Compares the two custom field objects.
|
void |
createValue(CustomField field,
Issue issue,
Set<Label> value)
Save the value for this Custom Field in a particular issue to the database.
|
String |
getChangelogValue(CustomField field,
Set<Label> value)
Returns a values to be stored in the change log, example is the id of the changed item.
|
Set<Label> |
getDefaultValue(FieldConfig fieldConfig)
Retrieves the Object representing the default CustomField value for the Custom Field.
|
String |
getEntityName()
The table name of the ofbiz entity (read database table) in which the custom field values for this custom field
type are persisted
|
EntityRepresentation |
getEntityRepresentation(ExternalCustomFieldValue customFieldValue)
Gets an EntityRepresentation that contains the correct attributes based on the populated fields in the
provided custom field value.
|
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)
Get the custom field representation of the issue, this object contains the column headers and values for each
of the
FieldExportPart . |
RestFieldOperationsHandler |
getRestFieldOperation(CustomField field)
Returns the RestFieldOperationsHandler for this field.
|
Label |
getSingularObjectFromString(String string)
Returns a Singular Object, given the string value as passed by the presentation tier.
|
String |
getStringFromSingularObject(Label singularObject)
Returns the
String representation of a single value within the CustomFieldType. |
Object |
getStringValueFromCustomFieldParams(CustomFieldParams parameters)
Return the String value object from the CustomFieldParams.
|
Set<Label> |
getValueFromCustomFieldParams(CustomFieldParams customFieldParams)
Retrieves the Transport Object representing the CustomField value instance from the CustomFieldParams of Strings.
|
Set<Label> |
getValueFromIssue(CustomField field,
Issue issue)
Retrieves the Transport Object representing the current CustomField value for the given issue.
|
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).
|
ExternalCustomFieldValue |
parse(Map attributes)
Parses the custom field value data from the backup XML.
|
Set<Long> |
remove(CustomField field)
Performs additional tasks when an entire CustomField of this type is being removed
CustomField.remove() . |
void |
setDefaultValue(FieldConfig fieldConfig,
Set<Label> value)
Sets the default value for a Custom Field
|
void |
updateValue(CustomField field,
Issue issue,
Set<Label> value)
Update the value for this Custom Field in a particular issue currently stored in the database.
|
void |
validateFromParams(CustomFieldParams relevantParams,
ErrorCollection errorCollectionToAddTo,
FieldConfig config)
Ensures that the
CustomFieldParams of Strings is a valid representation of the Custom Field values. |
boolean |
valuesEqual(Set<Label> oldLabels,
Set<Label> newLabels)
Used to compare 2 field values and work out whether a change item should be generated
|
assertObjectImplementsType, availableForBulkEdit, getChangelogString, getConfigurationItemTypes, getDescription, getDescriptor, getI18nBean, getKey, getName, getRelatedIndexers, getVelocityParameters, init, isRenderable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCloneOptionConfiguration, getCloneValue, isUserInputRequiredForMove
public LabelsCFType(JiraAuthenticationContext authenticationContext, IssueManager issueManager, GenericConfigManager genericConfigManager, LabelUtil labelUtil, LabelManager labelManager, ProjectImportLabelFieldParser projectImportableCustomFieldParser, JiraBaseUrls jiraBaseUrls)
@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<Set<Label>,Label>
getVelocityParameters
in class AbstractCustomFieldType<Set<Label>,Label>
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 Set<Label> getValueFromIssue(CustomField field, Issue issue)
CustomFieldType
getValueFromIssue
in interface CustomFieldType<Set<Label>,Label>
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)
public Set<Label> getDefaultValue(FieldConfig fieldConfig)
CustomFieldType
getDefaultValue
in interface CustomFieldType<Set<Label>,Label>
fieldConfig
- CustomField for default valuepublic void setDefaultValue(FieldConfig fieldConfig, Set<Label> value)
CustomFieldType
setDefaultValue
in interface CustomFieldType<Set<Label>,Label>
fieldConfig
- CustomField for which the default is being storedvalue
- Transport Object representing the value instance of the CustomFieldpublic String getChangelogValue(CustomField field, Set<Label> value)
CustomFieldType
getChangelogValue
in interface CustomFieldType<Set<Label>,Label>
field
- CustomField that the value belongs tovalue
- Transport Object representing the value instance of the CustomFieldpublic String getStringFromSingularObject(Label singularObject)
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<Set<Label>,Label>
singularObject
- the objectpublic Label getSingularObjectFromString(String string) throws FieldValidationException
CustomFieldType
getSingularObjectFromString
in interface CustomFieldType<Set<Label>,Label>
string
- the StringFieldValidationException
- if the string is an invalid representation of the Object.public Set<Long> remove(CustomField field)
CustomFieldType
CustomField.remove()
.
This includes removal of values & options.remove
in interface CustomFieldType<Set<Label>,Label>
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 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<Set<Label>,Label>
relevantParams
- parameter object of StringserrorCollectionToAddTo
- errorCollection to which any errors should be added (never null)config
- FieldConfigpublic void createValue(CustomField field, Issue issue, @Nonnull Set<Label> value)
CustomFieldType
createValue
in interface CustomFieldType<Set<Label>,Label>
field
- CustomField
for which the value is being storedissue
- The Issue
to be stored against.value
- Transport Object representing the value instance of the CustomField.
Can not be null
.public void updateValue(CustomField field, Issue issue, Set<Label> value)
CustomFieldType
updateValue
in interface CustomFieldType<Set<Label>,Label>
field
- CustomField
for which the value is being storedissue
- The Issue
to be stored against.value
- Transport Object representing the value instance of the CustomField.public Set<Label> getValueFromCustomFieldParams(CustomFieldParams customFieldParams) throws FieldValidationException
CustomFieldType
getValueFromCustomFieldParams
in interface CustomFieldType<Set<Label>,Label>
customFieldParams
- 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<Set<Label>,Label>
parameters
- - CustomFieldParams containing String valuespublic int compare(@Nonnull Set<Label> customFieldObjectValue1, @Nonnull Set<Label> customFieldObjectValue2, FieldConfig fieldConfig)
SortableCustomField
compare
in interface SortableCustomField<Set<Label>>
customFieldObjectValue1
- Never nullcustomFieldObjectValue2
- Never nullpublic String getEntityName()
ProjectImportableCustomFieldParser
getEntityName
in interface ProjectImportableCustomFieldParser
public ExternalCustomFieldValue parse(Map attributes) throws ParseException
CustomFieldValueParser
parse
in interface CustomFieldValueParser
attributes
- is a map of key value pairs that represent the attributes of an ExternalCustomFieldValue. The following
attributes are required, otherwise a ParseException will be thrown:ParseException
- if the required fields are not found in the attributes mappublic EntityRepresentation getEntityRepresentation(ExternalCustomFieldValue customFieldValue)
CustomFieldValueParser
getEntityRepresentation
in interface CustomFieldValueParser
customFieldValue
- contains the populated fields that will end up in the EntityRepresentations mappublic ProjectCustomFieldImporter getProjectImporter()
ProjectImportableCustomField
getProjectImporter
in interface ProjectImportableCustomField
public boolean valuesEqual(Set<Label> oldLabels, Set<Label> newLabels)
CustomFieldType
valuesEqual
in interface CustomFieldType<Set<Label>,Label>
valuesEqual
in class AbstractCustomFieldType<Set<Label>,Label>
oldLabels
- current valuenewLabels
- new valuepublic FieldExportParts getRepresentationFromIssue(Issue issue, CustomFieldExportContext context)
ExportableCustomFieldType
FieldExportPart
.getRepresentationFromIssue
in interface ExportableCustomFieldType
issue
- to get the representation forcontext
- which contains information such as the i18nHelper and fieldpublic Object accept(AbstractCustomFieldType.VisitorBase visitor)
accept
in class AbstractCustomFieldType<Set<Label>,Label>
public 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.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 FieldCopyright © 2002-2021 Atlassian. All Rights Reserved.