java.lang.Object
   ↳ com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType<T, S>
     ↳ com.atlassian.jira.issue.customfields.impl.LabelsCFType

Class Overview

Labels Custom field

Transport Object Type
Set of Labels
Singular Object Type
Label
Database Storage Type
Not stored with Custom Field Data @see setLabels(com.atlassian.crowd.embedded.api.User, Long, Long, java.util.Set, boolean, boolean)

Summary

Nested Classes
interface LabelsCFType.Visitor<T>  
[Expand]
Inherited Constants
From interface com.atlassian.jira.imports.project.parser.CustomFieldValueParser
From interface com.atlassian.jira.issue.customfields.CustomFieldType
Public Constructors
LabelsCFType(JiraAuthenticationContext authenticationContext, IssueManager issueManager, GenericConfigManager genericConfigManager, LabelUtil labelUtil, LabelManager labelManager, ProjectImportLabelFieldParser projectImportableCustomFieldParser, JiraBaseUrls jiraBaseUrls)
Public Methods
Object accept(VisitorBase visitor)
int compare(Set<Label> customFieldObjectValue1, Set<Label> customFieldObjectValue2, FieldConfig fieldConfig)
void createValue(CustomField field, Issue issue, Set<Label> value)
String getChangelogValue(CustomField field, Set<Label> value)
Set<Label> getDefaultValue(FieldConfig fieldConfig)
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.
RestFieldOperationsHandler getRestFieldOperation(CustomField field)
Returns the RestFieldOperationsHandler for this field.
Label getSingularObjectFromString(String string)
String getStringFromSingularObject(Label singularObject)
Object getStringValueFromCustomFieldParams(CustomFieldParams parameters)
Set<Label> getValueFromCustomFieldParams(CustomFieldParams customFieldParams)
Set<Label> getValueFromIssue(CustomField field, Issue issue)
@Nonnull Map<StringObject> 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)
void setDefaultValue(FieldConfig fieldConfig, Set<Label> value)
void updateValue(CustomField field, Issue issue, Set<Label> value)
void validateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config)
boolean valuesEqual(Set<Label> oldLabels, Set<Label> newLabels)
Used to compare 2 field values and work out whether a change item should be generated
[Expand]
Inherited Methods
From class com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
From class java.lang.Object
From interface com.atlassian.jira.imports.project.customfield.ProjectImportableCustomField
From interface com.atlassian.jira.imports.project.customfield.ProjectImportableCustomFieldParser
From interface com.atlassian.jira.imports.project.parser.CustomFieldValueParser
From interface com.atlassian.jira.issue.customfields.CustomFieldType
From interface com.atlassian.jira.issue.customfields.SortableCustomField
From interface com.atlassian.jira.issue.fields.rest.RestAwareCustomFieldType
From interface com.atlassian.jira.issue.fields.rest.RestCustomFieldTypeOperations

Public Constructors

public LabelsCFType (JiraAuthenticationContext authenticationContext, IssueManager issueManager, GenericConfigManager genericConfigManager, LabelUtil labelUtil, LabelManager labelManager, ProjectImportLabelFieldParser projectImportableCustomFieldParser, JiraBaseUrls jiraBaseUrls)

Public Methods

public Object accept (VisitorBase visitor)

public int compare (Set<Label> customFieldObjectValue1, Set<Label> customFieldObjectValue2, FieldConfig fieldConfig)

public void createValue (CustomField field, Issue issue, Set<Label> value)

public String getChangelogValue (CustomField field, Set<Label> value)

public Set<Label> getDefaultValue (FieldConfig fieldConfig)

public 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

Returns
  • The ofbiz table name for this custom field type

public EntityRepresentation getEntityRepresentation (ExternalCustomFieldValue customFieldValue)

Gets an EntityRepresentation that contains the correct attributes based on the populated fields in the provided custom field value.

Parameters
customFieldValue contains the populated fields that will end up in the EntityRepresentations map
Returns
  • an EntityRepresentation that can be persisted using OfBiz

public FieldTypeInfo getFieldTypeInfo (FieldTypeInfoContext fieldTypeInfoContext)

Returns lower level Information about the field. This information contains allowed values and/or the autocomplete url

Parameters
fieldTypeInfoContext context information for generating the FieldTypeInfo.
Returns
  • Low level information about the field.

public JsonData getJsonDefaultValue (IssueContext issueCtx, CustomField field)

Return The default data for this system field. May be null if there is no default.

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.

public FieldJsonRepresentation getJsonFromIssue (CustomField field, Issue issue, boolean renderedVersionRequested, FieldLayoutItem fieldLayoutItem)

Return a JsonData representation of the field value

Parameters
field configuration of the current field
issue to get field data from
renderedVersionRequested whether the use requested the return of rendered/pretty data as well as raw data
fieldLayoutItem 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.

public JsonType getJsonSchema (CustomField customField)

Return a description of the shape of this field when represented as JSON.

public ProjectCustomFieldImporter getProjectImporter ()

Returns the object that will perform the actual project import functions for the custom field type.

Returns
  • the object that will perform the actual project import functions for the custom field type.

public RestFieldOperationsHandler getRestFieldOperation (CustomField field)

Returns the RestFieldOperationsHandler for this field.

Parameters
field the Custom Field
Returns
  • the RestFieldOperationsHandler for this field.

public Label getSingularObjectFromString (String string)

public String getStringFromSingularObject (Label singularObject)

public Object getStringValueFromCustomFieldParams (CustomFieldParams parameters)

public Set<Label> getValueFromCustomFieldParams (CustomFieldParams customFieldParams)

public Set<Label> getValueFromIssue (CustomField field, Issue issue)

@Nonnull public Map<StringObject> 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).

The values are added to the context for all velocity views (edit, search, view, xml)

Parameters
issue The issue currently in context (Note: this will be null in cases like 'default value')
field CustomField
fieldLayoutItem FieldLayoutItem
Returns
  • A Map of parameters to add to the velocity context, or an empty Map otherwise (never null)

public ExternalCustomFieldValue parse (Map attributes)

Parses the custom field value data from the backup XML.

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

public Set<Long> remove (CustomField field)

public void setDefaultValue (FieldConfig fieldConfig, Set<Label> value)

public void updateValue (CustomField field, Issue issue, Set<Label> value)

public void validateFromParams (CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config)

public boolean valuesEqual (Set<Label> oldLabels, Set<Label> newLabels)

Used to compare 2 field values and work out whether a change item should be generated

Parameters
oldLabels current value
newLabels new value
Returns
  • true if the change item should be generated, false otherwise