com.atlassian.jira.issue.customfields.impl
Class MultiUserCFType

java.lang.Object
  extended by com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
      extended by com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType
          extended by com.atlassian.jira.issue.customfields.impl.StringCFType
              extended by com.atlassian.jira.issue.customfields.impl.TextCFType
                  extended by com.atlassian.jira.issue.customfields.impl.AbstractMultiCFType
                      extended by com.atlassian.jira.issue.customfields.impl.MultiUserCFType
All Implemented Interfaces:
ProjectImportableCustomField, CustomFieldType, SortableCustomField, UserCFNotificationTypeAware

public class MultiUserCFType
extends AbstractMultiCFType
implements UserCFNotificationTypeAware, ProjectImportableCustomField

Multiple Select Type

Transport Object Type
Collection
Singular Object Type
String


Field Summary
protected  MultiUserConverter multiUserConverter
           
 
Fields inherited from class com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType
customFieldValuePersister, FIELD_TYPE_DATE, FIELD_TYPE_NUMBER, FIELD_TYPE_STRING, FIELD_TYPE_TEXT, genericConfigManager, log
 
Fields inherited from interface com.atlassian.jira.issue.customfields.CustomFieldType
DEFAULT_VALUE_TYPE
 
Constructor Summary
MultiUserCFType(CustomFieldValuePersister customFieldValuePersister, StringConverter stringConverter, GenericConfigManager genericConfigManager, MultiUserConverter multiUserConverter, ApplicationProperties applicationProperties, JiraAuthenticationContext authenticationContext, UserPickerSearchService searchService)
           
 
Method Summary
protected  Object convertStringToType(String string)
          Converts a given String to underlying type
protected  String convertTypeToString(Object value)
          Converts a given underlying type to String.
 ProjectCustomFieldImporter getProjectImporter()
          This method will return a NoTransformationCustomFieldImporter, be mindful that if you are extending this class you need to have a good hard think about whether this is the right field importer for your custom field values.
 List getRelatedIndexers(CustomField customField)
          Returns a list of indexers that will be used for the field.
 Object getSingularObjectFromString(String s)
          Returns a Singular Object, given the string value as passed by the presentation tier.
 String getStringFromSingularObject(Object o)
          Returns the String representation of a single value within the CustomFieldType.
 Object getStringValueFromCustomFieldParams(CustomFieldParams parameters)
          Return the String value object from the CustomFieldParams.
protected  Comparator getTypeComparator()
          Returns a comparator for underlying type of this custom field.
 Object getValueFromCustomFieldParams(CustomFieldParams parameters)
          Retrieves the Object representing the CustomField value instance from the CustomFieldParams of Strings.
 Map 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).
 void validateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config)
          Ensures that the CustomFieldParams of Strings is a valid representation of the Custom Field values.
 
Methods inherited from class com.atlassian.jira.issue.customfields.impl.AbstractMultiCFType
convertStringsToTypes, convertTypesToStringsIfRequired, createValue, getChangelogValue, getDefaultValue, getValueFromIssue, setDefaultValue, updateValue
 
Methods inherited from class com.atlassian.jira.issue.customfields.impl.TextCFType
compare, getDatabaseType
 
Methods inherited from class com.atlassian.jira.issue.customfields.impl.StringCFType
getDbValueFromObject, getObjectFromDbValue, makeSearchParameter
 
Methods inherited from class com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType
remove
 
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.notification.type.UserCFNotificationTypeAware
getValueFromIssue
 
Methods inherited from interface com.atlassian.jira.issue.customfields.CustomFieldType
availableForBulkEdit, getChangelogString, getConfigurationItemTypes, getDescription, getDescriptor, getKey, getName, init, isRenderable, remove, valuesEqual
 

Field Detail

multiUserConverter

protected final MultiUserConverter multiUserConverter
Constructor Detail

MultiUserCFType

public MultiUserCFType(CustomFieldValuePersister customFieldValuePersister,
                       StringConverter stringConverter,
                       GenericConfigManager genericConfigManager,
                       MultiUserConverter multiUserConverter,
                       ApplicationProperties applicationProperties,
                       JiraAuthenticationContext authenticationContext,
                       UserPickerSearchService searchService)
Method Detail

getTypeComparator

protected Comparator getTypeComparator()
Description copied from class: AbstractMultiCFType
Returns a comparator for underlying type of this custom field.

Specified by:
getTypeComparator in class AbstractMultiCFType
Returns:
a comparator

getValueFromCustomFieldParams

public Object getValueFromCustomFieldParams(CustomFieldParams parameters)
                                     throws FieldValidationException
Description copied from interface: CustomFieldType
Retrieves the Object representing the CustomField value instance from the CustomFieldParams of Strings. This return type must exactly match that of the value Object parameter in the persistance methods (CustomFieldType.createValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object), CustomFieldType.updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object)) and Object returned from CustomFieldType.getValueFromIssue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue).

Specified by:
getValueFromCustomFieldParams in interface CustomFieldType
Overrides:
getValueFromCustomFieldParams in class AbstractSingleFieldType
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, java.lang.Object), CustomFieldType.updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object)
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, java.lang.Object), CustomFieldType.updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object), CustomFieldType.getValueFromIssue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue)

getStringValueFromCustomFieldParams

public Object getStringValueFromCustomFieldParams(CustomFieldParams parameters)
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)

Specified by:
getStringValueFromCustomFieldParams in interface CustomFieldType
Overrides:
getStringValueFromCustomFieldParams in class AbstractSingleFieldType
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 the CustomFieldParams of Strings is a valid representation of the Custom Field values. Any errors should be added to the ErrorCollection under the appropriate key as required.

Specified by:
validateFromParams in interface CustomFieldType
Overrides:
validateFromParams in class AbstractSingleFieldType
Parameters:
relevantParams - parameter object of Strings
errorCollectionToAddTo - errorCollection to which any erros should be added (never null)

getStringFromSingularObject

public String getStringFromSingularObject(Object o)
Description copied from interface: CustomFieldType
Returns the String representation of a single value within the CustomFieldType. This is the value that will 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 CustomFieldParams

Specified by:
getStringFromSingularObject in interface CustomFieldType
Overrides:
getStringFromSingularObject in class TextCFType
Returns:
String representation of the Object

getSingularObjectFromString

public Object 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 interface CustomFieldType
Overrides:
getSingularObjectFromString in class TextCFType
Returns:
singularObject instance
Throws:
FieldValidationException

getRelatedIndexers

public List getRelatedIndexers(CustomField customField)
Description copied from interface: CustomFieldType
Returns a list of indexers that will be used for the field. This will over-ride the anonymous searcher specified by AbstractCustomFieldSearcher.getRelatedIndexers() and AbstractCustomFieldSearcher.index(Document, CustomField, Object)

Specified by:
getRelatedIndexers in interface CustomFieldType
Overrides:
getRelatedIndexers in class AbstractCustomFieldType
Returns:
List of instantiated and initialised FieldIndexer objects. Null if no related indexers.

convertTypeToString

protected String convertTypeToString(Object value)
Description copied from class: AbstractMultiCFType
Converts a given underlying type to String. If the value parameter is already of type String then this String is just returned.

Specified by:
convertTypeToString in class AbstractMultiCFType
Parameters:
value - underlying type
Returns:
string representation of underlying type

convertStringToType

protected Object convertStringToType(String string)
Description copied from class: AbstractMultiCFType
Converts a given String to underlying type

Specified by:
convertStringToType in class AbstractMultiCFType
Parameters:
string - string representation of underlying type
Returns:
underlying type

getVelocityParameters

public Map 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 interface CustomFieldType
Overrides:
getVelocityParameters in class AbstractCustomFieldType
Parameters:
issue - The issue currently in context (Note: this will be null in cases like 'default value')
Returns:
A Map of parameters to add to the velocity context, or an empty Map otherwise (never null)

getProjectImporter

public ProjectCustomFieldImporter getProjectImporter()
Description copied from class: TextCFType
This method will return a NoTransformationCustomFieldImporter, be mindful that if you are extending this class you need to have a good hard think about whether this is the right field importer for your custom field values.

Specified by:
getProjectImporter in interface ProjectImportableCustomField
Overrides:
getProjectImporter in class TextCFType
Returns:
a NoTransformationCustomFieldImporter
See Also:
ProjectImportableCustomField.getProjectImporter()


Copyright © 2002-2009 Atlassian. All Rights Reserved.