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

Class Overview

Custom Field allow selection of a single ApplicationUser. For multi-user see MultiUserCFType

Transport Object Type
ApplicationUser
Database Storage Type
String of user name

Summary

Nested Classes
interface UserCFType.Visitor<T>  
[Expand]
Inherited Constants
From class com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType
From interface com.atlassian.jira.issue.customfields.CustomFieldType
Fields
public static final TypeDescriptor<SharedEntity.Identifier> ENTITY_TYPE
[Expand]
Inherited Fields
From class com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType
Public Constructors
UserCFType(CustomFieldValuePersister customFieldValuePersister, UserConverter userConverter, GenericConfigManager genericConfigManager, ApplicationProperties applicationProperties, JiraAuthenticationContext authenticationContext, FieldConfigSchemeManager fieldConfigSchemeManager, ProjectManager projectManager, SoyTemplateRendererProvider soyTemplateRendererProvider, GroupManager groupManager, ProjectRoleManager projectRoleManager, UserPickerSearchService searchService, JiraBaseUrls jiraBaseUrls, UserHistoryManager userHistoryManager, UserFilterManager userFilterManager, UserPickerSearchService userPickerSearchService, I18nHelper i18nHelper, EmailFormatter emailFormatter)
Public Methods
Object accept(VisitorBase visitor)
int compare(ApplicationUser customFieldObjectValue1, ApplicationUser customFieldObjectValue2, FieldConfig fieldConfig)
String getChangelogString(CustomField field, ApplicationUser value)
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.
String getChangelogValue(CustomField field, ApplicationUser value)
List<FieldConfigItemType> getConfigurationItemTypes()
Returns a List of FieldConfigItemType objects.
FieldTypeInfo getFieldTypeInfo(FieldTypeInfoContext fieldTypeInfoContext)
Returns lower level Information about the 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.
ApplicationUser getSingularObjectFromString(String string)
String getStringFromSingularObject(ApplicationUser value)
ApplicationUser getValueFromCustomFieldParams(CustomFieldParams relevantParams)
@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).
Set<Long> remove(CustomField field)
called when removing a field.
void setLoggedInUser(ApplicationUser loggedInUser)
Explicitly set current session
void updateValue(CustomField customField, Issue issue, ApplicationUser user)
the value does exist, and the new value is different than the existing one.
void validateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config)
This method validate the parameters based on the following criteria:
  1. If the specified new value is NOT a valid user, it fails.
Protected Methods
@Nonnull PersistenceFieldType getDatabaseType()
Type of database field needed to store this field.
Object getDbValueFromObject(ApplicationUser customFieldObject)
Returns the database representation of the Java object as stored for that CustomField.
ApplicationUser getObjectFromDbValue(Object databaseValue)
Returns the Transport Object for the given Custom Field value as represented by the value stored in the database
[Expand]
Inherited Methods
From class com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType
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.issue.customfields.CustomFieldType
From interface com.atlassian.jira.issue.customfields.SortableCustomField
From interface com.atlassian.jira.issue.fields.rest.AuthAwareField
From interface com.atlassian.jira.issue.fields.rest.RestAwareCustomFieldType
From interface com.atlassian.jira.issue.fields.rest.RestCustomFieldTypeOperations
From interface com.atlassian.jira.notification.type.UserCFNotificationTypeAware

Fields

public static final TypeDescriptor<SharedEntity.Identifier> ENTITY_TYPE

Public Constructors

public UserCFType (CustomFieldValuePersister customFieldValuePersister, UserConverter userConverter, GenericConfigManager genericConfigManager, ApplicationProperties applicationProperties, JiraAuthenticationContext authenticationContext, FieldConfigSchemeManager fieldConfigSchemeManager, ProjectManager projectManager, SoyTemplateRendererProvider soyTemplateRendererProvider, GroupManager groupManager, ProjectRoleManager projectRoleManager, UserPickerSearchService searchService, JiraBaseUrls jiraBaseUrls, UserHistoryManager userHistoryManager, UserFilterManager userFilterManager, UserPickerSearchService userPickerSearchService, I18nHelper i18nHelper, EmailFormatter emailFormatter)

Public Methods

public Object accept (VisitorBase visitor)

public int compare (ApplicationUser customFieldObjectValue1, ApplicationUser customFieldObjectValue2, FieldConfig fieldConfig)

public String getChangelogString (CustomField field, ApplicationUser value)

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.

Parameters
field CustomField that the value belongs to
value Transport Object representing the value instance of the CustomField
Returns
  • Change log string.

public String getChangelogValue (CustomField field, ApplicationUser value)

public List<FieldConfigItemType> getConfigurationItemTypes ()

Returns a List of FieldConfigItemType objects. Can not be immutable. This opens up possibilities for configurable custom fields.

Returns

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 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 ApplicationUser getSingularObjectFromString (String string)

public String getStringFromSingularObject (ApplicationUser value)

public ApplicationUser getValueFromCustomFieldParams (CustomFieldParams relevantParams)

@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 Set<Long> remove (CustomField field)

called when removing a field. return issue IDs affected.

Subclasses should override this if they have specific cleanup that they need to do (such as removing select list values)

public void setLoggedInUser (ApplicationUser loggedInUser)

Explicitly set current session

public void updateValue (CustomField customField, Issue issue, ApplicationUser user)

the value does exist, and the new value is different than the existing one.

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

This method validate the parameters based on the following criteria:

  1. If the specified new value is NOT a valid user, it fails.
  2. If the previous value is specified (obtained from the issue object in the "issue" key), and the specified new value is the same as the previous value, it succeeds and the rest of the validations are skipped. This is to be consistent with the Assignee field where even if the user might not pass the validation in the current context, as long as it does not change, we will let it go. This step relies on the caller to set the issue object into a parameter named "issue" in the relevantParams map.
  3. If a "requireProjectIds" parameter is specified and its value is "true", then the specified new value is checked against the user filtering criteria. Failing the check will immediately fail the whole validation. The "requireProjectIds" parameter indicates that the list of project id's is to be obtained from issue object or field config. The list of project id's might be required for validating project roles in the user filtering.
  4. Otherwise, the validation succeeds.

Parameters
relevantParams the custom field parameters, containing the new value under the null key, and optionally the previous value (username) as a single String item list under the key "oldValue", and also optionally the list of projectIds in the current context, as a String list under the key "projectIds", and also optionally a value to indicate whether to load project id's from field config with a single boolean item list under the key "requireProjectIds".
errorCollectionToAddTo any validation errors will be added into this collection
config the field configuration

Protected Methods

@Nonnull protected PersistenceFieldType getDatabaseType ()

Type of database field needed to store this field.

Returns

protected Object getDbValueFromObject (ApplicationUser customFieldObject)

Returns the database representation of the Java object as stored for that CustomField. (eg. ProjectId if the Value represents a project). Must be compatable with type returned by getDatabaseType()

Parameters
customFieldObject the Transport Object
Returns
  • String, Double or Date

protected ApplicationUser getObjectFromDbValue (Object databaseValue)

Returns the Transport Object for the given Custom Field value as represented by the value stored in the database

Parameters
databaseValue - String, Double or Date objects as returned from getDbValueFromObject(Object)
Returns
  • Domain object or GenericValue