Class MultiGroupCFType
java.lang.Object
com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType<Collection<S>,S>
com.atlassian.jira.issue.customfields.impl.AbstractMultiCFType<com.atlassian.crowd.embedded.api.Group>
com.atlassian.jira.issue.customfields.impl.MultiGroupCFType
- All Implemented Interfaces:
ProjectImportableCustomField
,CustomFieldType<Collection<com.atlassian.crowd.embedded.api.Group>,
,com.atlassian.crowd.embedded.api.Group> GroupSelectorField
,SortableCustomField<String>
,ExportableCustomFieldType
,RestAwareCustomFieldType
,RestCustomFieldTypeOperations
,UserField
public class MultiGroupCFType
extends AbstractMultiCFType<com.atlassian.crowd.embedded.api.Group>
implements GroupSelectorField, ProjectImportableCustomField, UserField, SortableCustomField<String>, RestAwareCustomFieldType, RestCustomFieldTypeOperations, ExportableCustomFieldType
Multiple User Group Select Type
- Transport Object Type
Collection
ofGroup
s- Singular Object Type
Group
- Database Storage Type
String
of group name
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
AbstractCustomFieldType.VisitorBase<X>
-
Field Summary
FieldsFields inherited from class com.atlassian.jira.issue.customfields.impl.AbstractMultiCFType
customFieldValuePersister, genericConfigManager
Fields inherited from interface com.atlassian.jira.issue.customfields.CustomFieldType
DEFAULT_VALUE_TYPE, RESOURCE_PREVIEW
-
Constructor Summary
ConstructorsConstructorDescriptionMultiGroupCFType
(CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager, MultiGroupConverter multiGroupConverter, PermissionManager permissionManager, JiraAuthenticationContext authenticationContext, GroupManager groupManager, FieldVisibilityManager fieldVisibilityManager, JiraBaseUrls jiraBaseUrls) -
Method Summary
Modifier and TypeMethodDescriptionint
compare
(String customFieldObjectValue1, String customFieldObjectValue2, FieldConfig fieldConfig) Compares the two custom field objects.protected com.atlassian.crowd.embedded.api.Group
convertDbValueToType
(Object dbValue) Converts a given db value to Single form of Transport Objectprotected Object
convertTypeToDbValue
(com.atlassian.crowd.embedded.api.Group value) Converts a given underlying type to its db storage value.protected PersistenceFieldType
Type of database field needed to store this field.getFieldTypeInfo
(FieldTypeInfoContext fieldTypeInfoContext) Returns lower level Information about the field.getIdentifiersForGroup
(String groupName) This method should be implemented in your custom type to return a List of identifiers of your group.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 ofNonNullCustomFieldProvider
that Jira will use to optimize indexing performance.Returns the object that will perform the actual project import functions for the custom field type.getRelatedIndexers
(CustomField customField) Returns a list of indexers that will be used for the field.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.com.atlassian.crowd.embedded.api.Group
Returns a Singular Object, given the string value as passed by the presentation tier.getStringFromSingularObject
(com.atlassian.crowd.embedded.api.Group o) Returns theString
representation of a single value within the CustomFieldType.getStringValueFromCustomFieldParams
(CustomFieldParams parameters) Return the String value object from the CustomFieldParams.protected Comparator<com.atlassian.crowd.embedded.api.Group>
Returns a comparator for underlying type of this custom field.Collection<com.atlassian.crowd.embedded.api.Group>
getValueFromCustomFieldParams
(CustomFieldParams parameters) Retrieves the Transport Object representing the CustomField value instance from the CustomFieldParams of Strings.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).boolean
void
validateFromParams
(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config) Ensures that theCustomFieldParams
of Strings is a valid representation of the Custom Field values.Methods inherited from class com.atlassian.jira.issue.customfields.impl.AbstractMultiCFType
convertDbObjectToTypes, convertTypesToDbObjects, createValue, getChangelogValue, getDefaultValue, getValueFromIssue, getValueFromIssue, remove, setDefaultValue, updateValue
Methods inherited from class com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
assertObjectImplementsType, availableForBulkEdit, getChangelogString, getConfigurationItemTypes, getDescription, getDescriptor, getI18nBean, getKey, getName, getVelocityParameters, init, isRenderable, valuesEqual
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.jira.issue.customfields.CustomFieldType
areAllRequiredParametersPresent, getCloneOptionConfiguration, getCloneValue, isUserInputRequiredForMove
-
Field Details
-
multiGroupConverter
-
-
Constructor Details
-
MultiGroupCFType
public MultiGroupCFType(CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager, MultiGroupConverter multiGroupConverter, PermissionManager permissionManager, JiraAuthenticationContext authenticationContext, GroupManager groupManager, FieldVisibilityManager fieldVisibilityManager, JiraBaseUrls jiraBaseUrls)
-
-
Method Details
-
getTypeComparator
Description copied from class:AbstractMultiCFType
Returns a comparator for underlying type of this custom field. Used e.g. for sorting values retrieved from the Database- Specified by:
getTypeComparator
in classAbstractMultiCFType<com.atlassian.crowd.embedded.api.Group>
- Returns:
- a comparator, null if can't be compared without extra context
-
getValueFromCustomFieldParams
public Collection<com.atlassian.crowd.embedded.api.Group> getValueFromCustomFieldParams(CustomFieldParams parameters) throws FieldValidationException Description copied from interface:CustomFieldType
Retrieves the Transport Object representing the CustomField value instance from the CustomFieldParams of Strings.- Specified by:
getValueFromCustomFieldParams
in interfaceCustomFieldType<Collection<com.atlassian.crowd.embedded.api.Group>,
com.atlassian.crowd.embedded.api.Group> - Parameters:
parameters
- 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:CustomFieldType
Return 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:
getStringValueFromCustomFieldParams
in interfaceCustomFieldType<Collection<com.atlassian.crowd.embedded.api.Group>,
com.atlassian.crowd.embedded.api.Group> - Parameters:
parameters
- - CustomFieldParams containing String values- Returns:
- String value object from the CustomFieldParams
-
validateFromParams
public void validateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config) Description copied from interface:CustomFieldType
Ensures that theCustomFieldParams
of Strings is a valid representation of the Custom Field values. Any errors should be added to theErrorCollection
under the appropriate key as required.- Specified by:
validateFromParams
in interfaceCustomFieldType<Collection<com.atlassian.crowd.embedded.api.Group>,
com.atlassian.crowd.embedded.api.Group> - Parameters:
relevantParams
- parameter object of StringserrorCollectionToAddTo
- errorCollection to which any errors should be added (never null)config
- FieldConfig
-
getStringFromSingularObject
Description copied from interface:CustomFieldType
Returns theString
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 theCollection
orMap
- Specified by:
getStringFromSingularObject
in interfaceCustomFieldType<Collection<com.atlassian.crowd.embedded.api.Group>,
com.atlassian.crowd.embedded.api.Group> - Parameters:
o
- the object- Returns:
- String representation of the Object
-
getSingularObjectFromString
public com.atlassian.crowd.embedded.api.Group getSingularObjectFromString(String s) throws FieldValidationException Description copied from interface:CustomFieldType
Returns 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:
getSingularObjectFromString
in interfaceCustomFieldType<Collection<com.atlassian.crowd.embedded.api.Group>,
com.atlassian.crowd.embedded.api.Group> - Parameters:
s
- the String- Returns:
- singularObject instance
- Throws:
FieldValidationException
- if the string is an invalid representation of the Object.
-
getRelatedIndexers
Description copied from interface:CustomFieldType
Returns a list of indexers that will be used for the field.- Specified by:
getRelatedIndexers
in interfaceCustomFieldType<Collection<com.atlassian.crowd.embedded.api.Group>,
com.atlassian.crowd.embedded.api.Group> - Overrides:
getRelatedIndexers
in classAbstractCustomFieldType<Collection<com.atlassian.crowd.embedded.api.Group>,
com.atlassian.crowd.embedded.api.Group> - Parameters:
customField
- the custom field to get the related indexers of.- Returns:
- List of instantiated and initialised
FieldIndexer
objects. Null if no related indexers.
-
getVelocityParameters
@Nonnull public Map<String,Object> getVelocityParameters(Issue issue, CustomField field, FieldLayoutItem fieldLayoutItem) Description copied from interface:CustomFieldType
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)
- Specified by:
getVelocityParameters
in interfaceCustomFieldType<Collection<com.atlassian.crowd.embedded.api.Group>,
com.atlassian.crowd.embedded.api.Group> - Overrides:
getVelocityParameters
in classAbstractCustomFieldType<Collection<com.atlassian.crowd.embedded.api.Group>,
com.atlassian.crowd.embedded.api.Group> - Parameters:
issue
- The issue currently in context (Note: this will be null in cases like 'default value')field
- CustomFieldfieldLayoutItem
- FieldLayoutItem- Returns:
- A
Map
of parameters to add to the velocity context, or an empty Map otherwise (never null)
-
convertTypeToDbValue
Description copied from class:AbstractMultiCFType
Converts a given underlying type to its db storage value. Must be compatable withPersistenceFieldType
returned byAbstractMultiCFType.getDatabaseType()
- Specified by:
convertTypeToDbValue
in classAbstractMultiCFType<com.atlassian.crowd.embedded.api.Group>
- Parameters:
value
- Single form of Transport Object- Returns:
- database representation of given Transport Object.
-
convertDbValueToType
Description copied from class:AbstractMultiCFType
Converts a given db value to Single form of Transport Object- Specified by:
convertDbValueToType
in classAbstractMultiCFType<com.atlassian.crowd.embedded.api.Group>
- Parameters:
dbValue
- db representation as returned byAbstractMultiCFType.convertTypeToDbValue(Object)
- Returns:
- Single form of Transport Object
-
getDatabaseType
Description copied from class:AbstractMultiCFType
Type of database field needed to store this field.- Specified by:
getDatabaseType
in classAbstractMultiCFType<com.atlassian.crowd.embedded.api.Group>
- Returns:
- One of the predefined
PersistenceFieldType
types.
-
isMultiple
public boolean isMultiple() -
getRepresentationFromIssue
Description copied from interface:ExportableCustomFieldType
Get the custom field representation of the issue, this object contains the column headers and values for each of theFieldExportPart
.- Specified by:
getRepresentationFromIssue
in interfaceExportableCustomFieldType
- Parameters:
issue
- to get the representation forcontext
- which contains information such as the i18nHelper and field- Returns:
- the exportable parts of this issue
-
getProjectImporter
Description copied from interface:ProjectImportableCustomField
Returns the object that will perform the actual project import functions for the custom field type.- Specified by:
getProjectImporter
in interfaceProjectImportableCustomField
- Returns:
- the object that will perform the actual project import functions for the custom field type.
-
getIdentifiersForGroup
Description copied from interface:GroupSelectorField
This method should be implemented in your custom type to return a List of identifiers of your group. Usually the identifier is just thegroupName
. However, some custom fields, such asSelectCFType
assign ids to their values and index the ids. In such a case, the custom field should return all the ids under which thegroupName
was indexed. These should match the values that were used in the implementation ofFieldIndexer.addIndex(Document, Issue, CustomFieldPrefetchedData)
- Specified by:
getIdentifiersForGroup
in interfaceGroupSelectorField
- Parameters:
groupName
- The name of the group- Returns:
- The group identifier that will be used to search for this group in the index
-
compare
public int compare(@Nonnull String customFieldObjectValue1, @Nonnull String customFieldObjectValue2, FieldConfig fieldConfig) Description copied from interface:SortableCustomField
Compares the two custom field objects.- Specified by:
compare
in interfaceSortableCustomField<String>
- Parameters:
customFieldObjectValue1
- Never nullcustomFieldObjectValue2
- Never null- Returns:
- 0, 1 or -1
-
getNonNullCustomFieldProvider
Description copied from interface:CustomFieldType
Returns an instance ofNonNullCustomFieldProvider
that Jira will use to optimize indexing performance.- Specified by:
getNonNullCustomFieldProvider
in interfaceCustomFieldType<Collection<com.atlassian.crowd.embedded.api.Group>,
com.atlassian.crowd.embedded.api.Group>
-
accept
- Overrides:
accept
in classAbstractMultiCFType<com.atlassian.crowd.embedded.api.Group>
-
getFieldTypeInfo
Description copied from interface:RestAwareCustomFieldType
Returns lower level Information about the field. This information contains allowed values and/or the autocomplete url- Specified by:
getFieldTypeInfo
in interfaceRestAwareCustomFieldType
- Parameters:
fieldTypeInfoContext
- context information for generating theFieldTypeInfo
.- Returns:
- Low level information about the field.
-
getJsonSchema
Description copied from interface:RestAwareCustomFieldType
Return a description of the shape of this field when represented as JSON.- Specified by:
getJsonSchema
in interfaceRestAwareCustomFieldType
-
getJsonFromIssue
public FieldJsonRepresentation getJsonFromIssue(CustomField field, Issue issue, boolean renderedVersionRequested, @Nullable FieldLayoutItem fieldLayoutItem) Description copied from interface:RestAwareCustomFieldType
Return a JsonData representation of the field value- Specified by:
getJsonFromIssue
in 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:RestCustomFieldTypeOperations
Returns the RestFieldOperationsHandler for this field.- Specified by:
getRestFieldOperation
in interfaceRestCustomFieldTypeOperations
- Parameters:
field
- the Custom Field- Returns:
- the RestFieldOperationsHandler for this field.
-
getJsonDefaultValue
Description copied from interface:RestCustomFieldTypeOperations
Return The default data for this system field. May be null if there is no default.- Specified by:
getJsonDefaultValue
in 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.
-