Class LabelsCFType
java.lang.Object
com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType<Set<Label>,Label>
com.atlassian.jira.issue.customfields.impl.LabelsCFType
- All Implemented Interfaces:
ProjectImportableCustomField,ProjectImportableCustomFieldParser,CustomFieldValueParser,CustomFieldType<Set<Label>,,Label> SortableCustomField<Set<Label>>,ExportableCustomFieldType,RestAwareCustomFieldType,RestCustomFieldTypeOperations
public class LabelsCFType
extends AbstractCustomFieldType<Set<Label>,Label>
implements SortableCustomField<Set<Label>>, ProjectImportableCustomFieldParser, ProjectImportableCustomField, RestAwareCustomFieldType, RestCustomFieldTypeOperations, ExportableCustomFieldType
Labels Custom field
- Transport Object Type
SetofLabels- Singular Object Type
Label- Database Storage Type
- Not stored with Custom Field Data @see
LabelManager.setLabels(ApplicationUser, Long, Long, Set, boolean, boolean)
- Since:
- v4.2
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
AbstractCustomFieldType.VisitorBase<X> -
Field Summary
Fields inherited from interface com.atlassian.jira.issue.customfields.CustomFieldType
DEFAULT_VALUE_TYPE, RESOURCE_PREVIEWFields inherited from interface com.atlassian.jira.imports.project.parser.CustomFieldValueParser
CUSTOM_FIELD_VALUE_ENTITY_NAME -
Constructor Summary
ConstructorsConstructorDescriptionLabelsCFType(JiraAuthenticationContext authenticationContext, IssueManager issueManager, GenericConfigManager genericConfigManager, LabelUtil labelUtil, LabelManager labelManager, ProjectImportLabelFieldParser projectImportableCustomFieldParser, JiraBaseUrls jiraBaseUrls) -
Method Summary
Modifier and TypeMethodDescriptionintcompare(Set<Label> customFieldObjectValue1, Set<Label> customFieldObjectValue2, FieldConfig fieldConfig) Compares the two custom field objects.voidcreateValue(CustomField field, Issue issue, Set<Label> value) Save the value for this Custom Field in a particular issue to the database.getChangelogValue(CustomField field, Set<Label> value) Returns a values to be stored in the change log, example is the id of the changed item.getDefaultValue(FieldConfig fieldConfig) Retrieves the Object representing the default CustomField value for the Custom Field.The table name of the ofbiz entity (read database table) in which the custom field values for this custom field type are persistedgetEntityRepresentation(ExternalCustomFieldValue customFieldValue) Gets an EntityRepresentation that contains the correct attributes based on the populated fields in the provided custom field value.getFieldTypeInfo(FieldTypeInfoContext fieldTypeInfoContext) Returns lower level Information about the field.getJsonDefaultValue(IssueContext issueCtx, CustomField field) Return The default data for this system field.getJsonFromIssue(CustomField field, Issue issue, boolean renderedVersionRequested, FieldLayoutItem fieldLayoutItem) Return a JsonData representation of the field valuegetJsonSchema(CustomField customField) Return a description of the shape of this field when represented as JSON.Returns an instance ofNonNullCustomFieldProviderthat Jira will use to optimize indexing performance.Returns the object that will perform the actual project import functions for the custom field type.getRepresentationFromIssue(Issue issue, CustomFieldExportContext context) Get the custom field representation of the issue, this object contains the column headers and values for each of theFieldExportPart.getRestFieldOperation(CustomField field) Returns the RestFieldOperationsHandler for this field.getSingularObjectFromString(String string) Returns a Singular Object, given the string value as passed by the presentation tier.getStringFromSingularObject(Label singularObject) Returns theStringrepresentation of a single value within the CustomFieldType.getStringValueFromCustomFieldParams(CustomFieldParams parameters) Return the String value object from the CustomFieldParams.getValueFromCustomFieldParams(CustomFieldParams customFieldParams) Retrieves the Transport Object representing the CustomField value instance from the CustomFieldParams of Strings.getValueFromIssue(CustomField field, Issue issue) Retrieves the Transport Object representing the current CustomField value for the given issue.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).Parses the custom field value data from the backup XML.remove(CustomField field) Performs additional tasks when an entire CustomField of this type is being removedCustomField.remove().voidsetDefaultValue(FieldConfig fieldConfig, Set<Label> value) Sets the default value for a Custom FieldvoidupdateValue(CustomField field, Issue issue, Set<Label> value) Update the value for this Custom Field in a particular issue currently stored in the database.voidvalidateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config) Ensures that theCustomFieldParamsof Strings is a valid representation of the Custom Field values.booleanvaluesEqual(Set<Label> oldLabels, Set<Label> newLabels) Used to compare 2 field values and work out whether a change item should be generatedMethods inherited from class com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
assertObjectImplementsType, availableForBulkEdit, getChangelogString, getConfigurationItemTypes, getDescription, getDescriptor, getI18nBean, getKey, getName, getRelatedIndexers, getVelocityParameters, init, isRenderableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.jira.issue.customfields.CustomFieldType
areAllRequiredParametersPresent, getCloneOptionConfiguration, getCloneValue, getIndexers, isUserInputRequiredForMove, requiresAdditionalParams
-
Constructor Details
-
LabelsCFType
public LabelsCFType(JiraAuthenticationContext authenticationContext, IssueManager issueManager, GenericConfigManager genericConfigManager, LabelUtil labelUtil, LabelManager labelManager, ProjectImportLabelFieldParser projectImportableCustomFieldParser, JiraBaseUrls jiraBaseUrls)
-
-
Method Details
-
getVelocityParameters
@Nonnull public Map<String,Object> getVelocityParameters(Issue issue, CustomField field, FieldLayoutItem fieldLayoutItem) Description copied from interface:CustomFieldTypeThe custom field may wish to pass parameters to the velocity context beyond the getValueFromIssue methods (eg managers).The values are added to the context for all velocity views (edit, search, view, xml)
- Specified by:
getVelocityParametersin interfaceCustomFieldType<Set<Label>,Label> - Overrides:
getVelocityParametersin classAbstractCustomFieldType<Set<Label>,Label> - Parameters:
issue- The issue currently in context (Note: this will be null in cases like 'default value')field- CustomFieldfieldLayoutItem- FieldLayoutItem- Returns:
- A
Mapof parameters to add to the velocity context, or an empty Map otherwise (never null)
-
getValueFromIssue
Description copied from interface:CustomFieldTypeRetrieves the Transport Object representing the current CustomField value for the given issue.- Specified by:
getValueFromIssuein interfaceCustomFieldType<Set<Label>,Label> - 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)
-
getDefaultValue
Description copied from interface:CustomFieldTypeRetrieves the Object representing the default CustomField value for the Custom Field.- Specified by:
getDefaultValuein interfaceCustomFieldType<Set<Label>,Label> - Parameters:
fieldConfig- CustomField for default value- Returns:
- Transport Object of the Default Value
-
setDefaultValue
Description copied from interface:CustomFieldTypeSets the default value for a Custom Field- Specified by:
setDefaultValuein interfaceCustomFieldType<Set<Label>,Label> - Parameters:
fieldConfig- CustomField for which the default is being storedvalue- Transport Object representing the value instance of the CustomField
-
getChangelogValue
Description copied from interface:CustomFieldTypeReturns a values to be stored in the change log, example is the id of the changed item.- Specified by:
getChangelogValuein interfaceCustomFieldType<Set<Label>,Label> - Parameters:
field- CustomField that the value belongs tovalue- Transport Object representing the value instance of the CustomField- Returns:
- Change log value.
-
getStringFromSingularObject
Description copied from interface:CustomFieldTypeReturns theStringrepresentation 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 theCollectionorMap- Specified by:
getStringFromSingularObjectin interfaceCustomFieldType<Set<Label>,Label> - Parameters:
singularObject- the object- Returns:
- String representation of the Object
-
getSingularObjectFromString
Description copied from interface:CustomFieldTypeReturns a Singular Object, given the string value as passed by the presentation tier. Throws FieldValidationException if the string is an invalid representation of the Object.- Specified by:
getSingularObjectFromStringin interfaceCustomFieldType<Set<Label>,Label> - Parameters:
string- the String- Returns:
- singularObject instance
- Throws:
FieldValidationException- if the string is an invalid representation of the Object.
-
remove
Description copied from interface:CustomFieldTypePerforms additional tasks when an entire CustomField of this type is being removedCustomField.remove(). This includes removal of values & options. -
validateFromParams
public void validateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config) Description copied from interface:CustomFieldTypeEnsures that theCustomFieldParamsof Strings is a valid representation of the Custom Field values. Any errors should be added to theErrorCollectionunder the appropriate key as required.- Specified by:
validateFromParamsin interfaceCustomFieldType<Set<Label>,Label> - Parameters:
relevantParams- parameter object of StringserrorCollectionToAddTo- errorCollection to which any errors should be added (never null)config- FieldConfig
-
createValue
Description copied from interface:CustomFieldTypeSave the value for this Custom Field in a particular issue to the database.- Specified by:
createValuein interfaceCustomFieldType<Set<Label>,Label> - Parameters:
field-CustomFieldfor which the value is being storedissue- TheIssueto be stored against.value- Transport Object representing the value instance of the CustomField. Can not benull.
-
updateValue
Description copied from interface:CustomFieldTypeUpdate the value for this Custom Field in a particular issue currently stored in the database.- Specified by:
updateValuein interfaceCustomFieldType<Set<Label>,Label> - Parameters:
field-CustomFieldfor which the value is being storedissue- TheIssueto be stored against.value- Transport Object representing the value instance of the CustomField.
-
getValueFromCustomFieldParams
public Set<Label> getValueFromCustomFieldParams(CustomFieldParams customFieldParams) throws FieldValidationException Description copied from interface:CustomFieldTypeRetrieves the Transport Object representing the CustomField value instance from the CustomFieldParams of Strings.- Specified by:
getValueFromCustomFieldParamsin interfaceCustomFieldType<Set<Label>,Label> - Parameters:
customFieldParams- CustomFieldParams of String objects. Will contain one value for Singular field types.- 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) - Throws:
FieldValidationException- if the String value fails to convert into Objects- See Also:
-
CustomFieldType.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)
-
getStringValueFromCustomFieldParams
Description copied from interface:CustomFieldTypeReturn the String value object from the CustomFieldParams. The object may be a single String (e.g. TextCFType, List of Strings (e.g. MultiSelectCFType) or CustomFieldParams of Strings (e.g. CascadingSelectCFType). Among other things these values are passed to Velocity for rendering edit screens.- Specified by:
getStringValueFromCustomFieldParamsin interfaceCustomFieldType<Set<Label>,Label> - Parameters:
parameters- - CustomFieldParams containing String values- Returns:
- String value object from the CustomFieldParams
-
compare
public int compare(@Nonnull Set<Label> customFieldObjectValue1, @Nonnull Set<Label> customFieldObjectValue2, FieldConfig fieldConfig) Description copied from interface:SortableCustomFieldCompares the two custom field objects.- Specified by:
comparein interfaceSortableCustomField<Set<Label>>- Parameters:
customFieldObjectValue1- Never nullcustomFieldObjectValue2- Never null- Returns:
- 0, 1 or -1
-
getEntityName
Description copied from interface:ProjectImportableCustomFieldParserThe table name of the ofbiz entity (read database table) in which the custom field values for this custom field type are persisted- Specified by:
getEntityNamein interfaceProjectImportableCustomFieldParser- Returns:
- The ofbiz table name for this custom field type
-
parse
Description copied from interface:CustomFieldValueParserParses the custom field value data from the backup XML.- Specified by:
parsein interfaceCustomFieldValueParser- Parameters:
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:
- id (required)
- customfield (required)
- issue (required)
- Returns:
- an ExternalCustomFieldValue if the attributes contain the required fields
- Throws:
ParseException- if the required fields are not found in the attributes map
-
getEntityRepresentation
Description copied from interface:CustomFieldValueParserGets an EntityRepresentation that contains the correct attributes based on the populated fields in the provided custom field value.- Specified by:
getEntityRepresentationin interfaceCustomFieldValueParser- Parameters:
customFieldValue- contains the populated fields that will end up in the EntityRepresentations map- Returns:
- an EntityRepresentation that can be persisted using OfBiz
-
getProjectImporter
Description copied from interface:ProjectImportableCustomFieldReturns the object that will perform the actual project import functions for the custom field type.- Specified by:
getProjectImporterin interfaceProjectImportableCustomField- Returns:
- the object that will perform the actual project import functions for the custom field type.
-
valuesEqual
Description copied from interface:CustomFieldTypeUsed to compare 2 field values and work out whether a change item should be generated- Specified by:
valuesEqualin interfaceCustomFieldType<Set<Label>,Label> - Overrides:
valuesEqualin classAbstractCustomFieldType<Set<Label>,Label> - Parameters:
oldLabels- current valuenewLabels- new value- Returns:
- true if the change item should be generated, false otherwise
-
getRepresentationFromIssue
Description copied from interface:ExportableCustomFieldTypeGet the custom field representation of the issue, this object contains the column headers and values for each of theFieldExportPart.- Specified by:
getRepresentationFromIssuein interfaceExportableCustomFieldType- Parameters:
issue- to get the representation forcontext- which contains information such as the i18nHelper and field- Returns:
- the exportable parts of this issue
-
accept
- Overrides:
acceptin classAbstractCustomFieldType<Set<Label>,Label>
-
getFieldTypeInfo
Description copied from interface:RestAwareCustomFieldTypeReturns lower level Information about the field. This information contains allowed values and/or the autocomplete url- Specified by:
getFieldTypeInfoin interfaceRestAwareCustomFieldType- Parameters:
fieldTypeInfoContext- context information for generating theFieldTypeInfo.- Returns:
- Low level information about the field.
-
getJsonSchema
Description copied from interface:RestAwareCustomFieldTypeReturn a description of the shape of this field when represented as JSON.- Specified by:
getJsonSchemain interfaceRestAwareCustomFieldType
-
getJsonFromIssue
public FieldJsonRepresentation getJsonFromIssue(CustomField field, Issue issue, boolean renderedVersionRequested, @Nullable FieldLayoutItem fieldLayoutItem) Description copied from interface:RestAwareCustomFieldTypeReturn a JsonData representation of the field value- Specified by:
getJsonFromIssuein interfaceRestAwareCustomFieldType- Parameters:
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.- Returns:
- FieldJsonDataPair containing a json representation of the raw data for this field, and if required, a json representation of the rendered data for easy display.
-
getRestFieldOperation
Description copied from interface:RestCustomFieldTypeOperationsReturns the RestFieldOperationsHandler for this field.- Specified by:
getRestFieldOperationin interfaceRestCustomFieldTypeOperations- Parameters:
field- the Custom Field- Returns:
- the RestFieldOperationsHandler for this field.
-
getJsonDefaultValue
Description copied from interface:RestCustomFieldTypeOperationsReturn The default data for this system field. May be null if there is no default.- Specified by:
getJsonDefaultValuein interfaceRestCustomFieldTypeOperations- Parameters:
issueCtx- Issue (This should really only need to be an issue context, but for historical reasons we need an issue object.field- the Custom Field- Returns:
- The default data for this system field.
-
getNonNullCustomFieldProvider
Description copied from interface:CustomFieldTypeReturns an instance ofNonNullCustomFieldProviderthat Jira will use to optimize indexing performance.- Specified by:
getNonNullCustomFieldProviderin interfaceCustomFieldType<Set<Label>,Label>
-