public class UserCFType extends AbstractSingleFieldType<ApplicationUser> implements SortableCustomField<ApplicationUser>, UserCFNotificationTypeAware, ProjectImportableCustomField, UserField, RestAwareCustomFieldType, RestCustomFieldTypeOperations, ExportableCustomFieldType
ApplicationUser
. For multi-user see MultiUserCFType
ApplicationUser
String
of user nameModifier and Type | Class and Description |
---|---|
static interface |
UserCFType.Visitor<T> |
AbstractCustomFieldType.VisitorBase<X>
Modifier and Type | Field and Description |
---|---|
static SharedEntity.TypeDescriptor<SharedEntity.Identifier> |
ENTITY_TYPE |
customFieldValuePersister, FIELD_TYPE_DATE, FIELD_TYPE_NUMBER, FIELD_TYPE_STRING, FIELD_TYPE_TEXT, genericConfigManager, log
DEFAULT_VALUE_TYPE, RESOURCE_PREVIEW
Constructor and Description |
---|
UserCFType(CustomFieldValuePersister customFieldValuePersister,
UserConverter userConverter,
GenericConfigManager genericConfigManager,
ApplicationProperties applicationProperties,
JiraAuthenticationContext authenticationContext,
FieldConfigSchemeManager fieldConfigSchemeManager,
ProjectManager projectManager,
SoyTemplateRendererProvider soyTemplateRendererProvider,
GroupManager groupManager,
ProjectRoleManager projectRoleManager,
UserSearchService searchService,
JiraBaseUrls jiraBaseUrls,
UserHistoryManager userHistoryManager,
UserFilterManager userFilterManager,
I18nHelper i18nHelper,
UserBeanFactory userBeanFactory) |
Modifier and Type | Method and Description |
---|---|
Object |
accept(AbstractCustomFieldType.VisitorBase visitor) |
int |
compare(ApplicationUser customFieldObjectValue1,
ApplicationUser customFieldObjectValue2,
FieldConfig fieldConfig)
Compares the two custom field objects.
|
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)
Returns a values to be stored in the change log, example is the id of the changed item.
|
List<FieldConfigItemType> |
getConfigurationItemTypes()
Returns a List of
FieldConfigItemType objects. |
protected PersistenceFieldType |
getDatabaseType()
Type of database field needed to store this field.
|
protected Object |
getDbValueFromObject(ApplicationUser customFieldObject)
Returns the database representation of the Java object as stored for that CustomField.
|
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.
|
protected ApplicationUser |
getObjectFromDbValue(Object databaseValue)
Returns the Transport Object for the given Custom Field value as represented by the value
stored in the database
|
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.
|
ApplicationUser |
getSingularObjectFromString(String string)
Returns a Singular Object, given the string value as passed by the presentation tier.
|
String |
getStringFromSingularObject(ApplicationUser value)
Returns the
String representation of a single value within the CustomFieldType. |
ApplicationUser |
getValueFromCustomFieldParams(CustomFieldParams relevantParams)
Retrieves the Transport Object representing the CustomField value instance from the CustomFieldParams of Strings.
|
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).
|
Set<Long> |
remove(CustomField field)
called when removing a field.
|
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:
If the specified new value is NOT a valid user, it fails.
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.
|
createValue, getDefaultValue, getJsonDefaultValue, getStringValueFromCustomFieldParams, getValueFromIssue, getValueFromIssue, setDefaultValue
assertObjectImplementsType, availableForBulkEdit, getDescription, getDescriptor, getI18nBean, getKey, getName, getRelatedIndexers, getVelocityParameters, init, isRenderable, valuesEqual
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getValueFromIssue
getJsonDefaultValue
getCloneOptionConfiguration, getCloneValue, isUserInputRequiredForMove
public static final SharedEntity.TypeDescriptor<SharedEntity.Identifier> ENTITY_TYPE
public UserCFType(CustomFieldValuePersister customFieldValuePersister, UserConverter userConverter, GenericConfigManager genericConfigManager, ApplicationProperties applicationProperties, JiraAuthenticationContext authenticationContext, FieldConfigSchemeManager fieldConfigSchemeManager, ProjectManager projectManager, SoyTemplateRendererProvider soyTemplateRendererProvider, GroupManager groupManager, ProjectRoleManager projectRoleManager, UserSearchService searchService, JiraBaseUrls jiraBaseUrls, UserHistoryManager userHistoryManager, UserFilterManager userFilterManager, I18nHelper i18nHelper, UserBeanFactory userBeanFactory)
public void updateValue(CustomField customField, Issue issue, ApplicationUser user)
AbstractSingleFieldType
updateValue
in interface CustomFieldType<ApplicationUser,ApplicationUser>
updateValue
in class AbstractSingleFieldType<ApplicationUser>
customField
- CustomField
for which the value is being storedissue
- The Issue
to be stored against.user
- Transport Object representing the value instance of the CustomField.public String getChangelogValue(CustomField field, ApplicationUser value)
CustomFieldType
getChangelogValue
in interface CustomFieldType<ApplicationUser,ApplicationUser>
getChangelogValue
in class AbstractSingleFieldType<ApplicationUser>
field
- CustomField that the value belongs tovalue
- Transport Object representing the value instance of the CustomFieldpublic String getChangelogString(CustomField field, ApplicationUser value)
CustomFieldType
getChangelogString
in interface CustomFieldType<ApplicationUser,ApplicationUser>
getChangelogString
in class AbstractCustomFieldType<ApplicationUser,ApplicationUser>
field
- CustomField that the value belongs tovalue
- Transport Object representing the value instance of the CustomFieldprotected Object getDbValueFromObject(ApplicationUser customFieldObject)
AbstractSingleFieldType
AbstractSingleFieldType.getDatabaseType()
getDbValueFromObject
in class AbstractSingleFieldType<ApplicationUser>
customFieldObject
- the Transport Objectprotected ApplicationUser getObjectFromDbValue(@Nonnull Object databaseValue) throws FieldValidationException
AbstractSingleFieldType
getObjectFromDbValue
in class AbstractSingleFieldType<ApplicationUser>
databaseValue
- - String, Double or Date objects as returned from AbstractSingleFieldType.getDbValueFromObject(Object)
FieldValidationException
- if field validation fails.public String getStringFromSingularObject(ApplicationUser value)
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<ApplicationUser,ApplicationUser>
value
- the objectpublic ApplicationUser getSingularObjectFromString(String string) throws FieldValidationException
CustomFieldType
getSingularObjectFromString
in interface CustomFieldType<ApplicationUser,ApplicationUser>
string
- the StringFieldValidationException
- if the string is an invalid representation of the Object.public void validateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config)
relevantParams
map.validateFromParams
in interface CustomFieldType<ApplicationUser,ApplicationUser>
validateFromParams
in class AbstractSingleFieldType<ApplicationUser>
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 collectionconfig
- the field configurationpublic ApplicationUser getValueFromCustomFieldParams(CustomFieldParams relevantParams) throws FieldValidationException
CustomFieldType
getValueFromCustomFieldParams
in interface CustomFieldType<ApplicationUser,ApplicationUser>
getValueFromCustomFieldParams
in class AbstractSingleFieldType<ApplicationUser>
relevantParams
- 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 int compare(@Nonnull ApplicationUser customFieldObjectValue1, @Nonnull ApplicationUser customFieldObjectValue2, FieldConfig fieldConfig)
SortableCustomField
compare
in interface SortableCustomField<ApplicationUser>
customFieldObjectValue1
- Never nullcustomFieldObjectValue2
- Never null@Nonnull protected PersistenceFieldType getDatabaseType()
AbstractSingleFieldType
getDatabaseType
in class AbstractSingleFieldType<ApplicationUser>
PersistenceFieldType
types.@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<ApplicationUser,ApplicationUser>
getVelocityParameters
in class AbstractCustomFieldType<ApplicationUser,ApplicationUser>
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 List<FieldConfigItemType> getConfigurationItemTypes()
CustomFieldType
FieldConfigItemType
objects. Can not be immutable.
This opens up possibilities for configurable custom fields.getConfigurationItemTypes
in interface CustomFieldType<ApplicationUser,ApplicationUser>
getConfigurationItemTypes
in class AbstractCustomFieldType<ApplicationUser,ApplicationUser>
FieldConfigItemType
public ProjectCustomFieldImporter getProjectImporter()
ProjectImportableCustomField
getProjectImporter
in interface ProjectImportableCustomField
public Object accept(AbstractCustomFieldType.VisitorBase visitor)
accept
in class AbstractSingleFieldType<ApplicationUser>
public 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 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 Set<Long> remove(CustomField field)
AbstractSingleFieldType
Subclasses should override this if they have specific cleanup that they need to do (such as removing select list values)
remove
in interface CustomFieldType<ApplicationUser,ApplicationUser>
remove
in class AbstractSingleFieldType<ApplicationUser>
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 affectedCopyright © 2002-2017 Atlassian. All Rights Reserved.