@PublicApi public class

NoTransformationCustomFieldImporter

extends Object
implements ProjectCustomFieldImporter
java.lang.Object
   ↳ com.atlassian.jira.imports.project.customfield.NoTransformationCustomFieldImporter

@PublicApi

This class is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Class Overview

This class provides an implementation of ProjectCustomFieldImporter for Custom Fields which don't need to transform the custom field value upon import into a new JIRA instance. This would be used for any Custom Fields that store a "literal value" - eg text, date, etc.

The getMappedImportValue(ProjectImportMapper, ExternalCustomFieldValue, FieldConfig) method will just return the original value, and the canMapImportValue(ProjectImportMapper, ExternalCustomFieldValue, FieldConfig, I18nHelper) method will never return errors or warnings.

Summary

Public Constructors
NoTransformationCustomFieldImporter()
Public Methods
MessageSet canMapImportValue(ProjectImportMapper projectImportMapper, ExternalCustomFieldValue customFieldValue, FieldConfig fieldConfig, I18nHelper i18n)
The custom field needs to determine if the provided custom field value, in the context of the config and project import mapper, is a valid value that can be imported.
ProjectCustomFieldImporter.MappedCustomFieldValue getMappedImportValue(ProjectImportMapper projectImportMapper, ExternalCustomFieldValue customFieldValue, FieldConfig fieldConfig)
The custom field needs to determine what the "mapped" value will be for the provided custom field value and return this new string representation of the value.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.imports.project.customfield.ProjectCustomFieldImporter

Public Constructors

public NoTransformationCustomFieldImporter ()

Public Methods

public MessageSet canMapImportValue (ProjectImportMapper projectImportMapper, ExternalCustomFieldValue customFieldValue, FieldConfig fieldConfig, I18nHelper i18n)

The custom field needs to determine if the provided custom field value, in the context of the config and project import mapper, is a valid value that can be imported.

The implementation has two ways to report dependencies:

  • It can use the flagAsRequired() method on the appropriate System object Mapper if it simply wants to report that it requires a particular object from the import file.
    If this object cannot be mapped into the new System, then the Project Import will report an erro against that Object type (eg Version).
  • It can create its own error messages and/or warnings and add them to the returned MessageSet.
    These messages will be reported in the context of the particular Custom Field.
Because these two ways of creating messages will be shown in different contexts, it is valid for a Custom Field developer to choose to report a single problem both ways.

If this method does not return any errors in the MessageSet, and any objects marked as required can be mapped in the new system, then it is safe to do the import and call the getMappedImportValue(ProjectImportMapper, ExternalCustomFieldValue, FieldConfig) method.

It is valid for implementors of this method to return null, and this will be treated the same as an empty MessageSet.

Parameters
projectImportMapper contains a fully populated and validated ProjectImportMapper which contains system mappings that the custom fields can use to determine if the value is one that they can map.
customFieldValue the Object representation of the stored custom field value.
fieldConfig the relevant FieldConfig that the custom field value is in use with. This will allow the custom field to lookup any relevant options that it may have configured.
i18n an i18nHelper setup from the custom fields configuration that can be used to i18n error and warning messages.
Returns
  • a MessageSet that will contain any errors or warnings that the custom field wants to report, in an i18n'ed form. Errors returned in the MessageSet will cause the project import to stop.

public ProjectCustomFieldImporter.MappedCustomFieldValue getMappedImportValue (ProjectImportMapper projectImportMapper, ExternalCustomFieldValue customFieldValue, FieldConfig fieldConfig)

The custom field needs to determine what the "mapped" value will be for the provided custom field value and return this new string representation of the value. This value may come from the passed in project import mapper, it may come from mapping custom field options, or may come from an external system.

Parameters
projectImportMapper contains a fully populated and validated ProjectImportMapper which contains system mappings that the custom fields can use to determine if the value is one that they can map.
customFieldValue the Object representation of the stored custom field value.
fieldConfig the relevant FieldConfig that the custom field value is in use with. This will allow the custom field to lookup any relevant options that it may have configured.
Returns
  • the Object representation of the valid mapped value (and possibly parentKey value) for the passed in custom field value.