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

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.SelectCFType
All Implemented Interfaces:
ProjectImportableCustomField, CustomFieldType, GroupSelectorField, MultipleCustomFieldType, MultipleSettableCustomFieldType, SortableCustomField<java.lang.String>

public class SelectCFType
extends TextCFType
implements MultipleSettableCustomFieldType, MultipleCustomFieldType, SortableCustomField<java.lang.String>, GroupSelectorField


Nested Class Summary
static interface SelectCFType.Visitor<T>
           
 
Nested classes/interfaces inherited from class com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
AbstractCustomFieldType.VisitorBase<T>
 
Field Summary
 
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
 
Fields inherited from interface com.atlassian.jira.issue.customfields.CustomFieldType
DEFAULT_VALUE_TYPE
 
Constructor Summary
SelectCFType(CustomFieldValuePersister customFieldValuePersister, StringConverter stringConverter, SelectConverter selectConverter, OptionsManager optionsManager, GenericConfigManager genericConfigManager)
           
 
Method Summary
 java.lang.Object accept(AbstractCustomFieldType.VisitorBase visitor)
           
 int compare(java.lang.String customFieldObjectValue1, java.lang.String customFieldObjectValue2, FieldConfig fieldConfig)
          Compares the two custom field objects.
 java.util.List getConfigurationItemTypes()
          Returns a List of FieldConfigItemType objects.
 java.util.Set getIssueIdsWithValue(CustomField field, Option option)
          Returns a Set with of Long Objects representing the issue ids that the value has been set for
 Options getOptions(FieldConfig config, JiraContextNode jiraContextNode)
           
 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.
 org.apache.lucene.search.Query getQueryForGroup(java.lang.String fieldID, java.lang.String groupName)
          This method should be implemented in your custom type to return a Query.
 java.lang.Object getSingularObjectFromString(java.lang.String string)
          Returns a Singular Object, given the string value as passed by the presentation tier.
 java.lang.String getStringFromSingularObject(java.lang.Object value)
          Returns the String representation of a single value within the CustomFieldType.
 java.util.Set remove(CustomField field)
          called when removing a field.
 void removeValue(CustomField field, Issue issue, Option option)
          This default implementation will remove all values from the custom field for an issue.
 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.TextCFType
getDatabaseType
 
Methods inherited from class com.atlassian.jira.issue.customfields.impl.StringCFType
getDbValueFromObject, getObjectFromDbValue
 
Methods inherited from class com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType
createValue, getChangelogValue, getDefaultValue, getStringValueFromCustomFieldParams, getValueFromCustomFieldParams, getValueFromIssue, setDefaultValue, updateValue
 
Methods inherited from class com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
assertObjectImplementsType, availableForBulkEdit, getChangelogString, getDescription, getDescriptor, getI18nBean, getKey, getName, getRelatedIndexers, getVelocityParameters, 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
availableForBulkEdit, createValue, getChangelogString, getChangelogValue, getDefaultValue, getDescription, getDescriptor, getKey, getName, getRelatedIndexers, getStringValueFromCustomFieldParams, getValueFromCustomFieldParams, getValueFromIssue, getVelocityParameters, init, isRenderable, setDefaultValue, updateValue, valuesEqual
 

Constructor Detail

SelectCFType

public SelectCFType(CustomFieldValuePersister customFieldValuePersister,
                    StringConverter stringConverter,
                    SelectConverter selectConverter,
                    OptionsManager optionsManager,
                    GenericConfigManager genericConfigManager)
Method Detail

remove

public java.util.Set remove(CustomField field)
Description copied from class: AbstractSingleFieldType
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)

Specified by:
remove in interface CustomFieldType
Overrides:
remove in class AbstractSingleFieldType
Parameters:
field - The custom field that is being removed, so any data stored for any issues for that field can be deleted.
Returns:
Set of issue ids that has been affected

removeValue

public void removeValue(CustomField field,
                        Issue issue,
                        Option option)
This default implementation will remove all values from the custom field for an issue. Since there can only be one value for each CustomField instance, this implemenation can safely ignore the objectValue

Specified by:
removeValue in interface MultipleSettableCustomFieldType
Parameters:
field -
issue -
option - - ignored

getSingularObjectFromString

public java.lang.Object getSingularObjectFromString(java.lang.String string)
                                             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
Parameters:
string - the String
Returns:
singularObject instance
Throws:
FieldValidationException - if the string is an invalid representation of the Object.

getStringFromSingularObject

public java.lang.String getStringFromSingularObject(java.lang.Object value)
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
Parameters:
value - the object
Returns:
String representation of the Object

getIssueIdsWithValue

public java.util.Set getIssueIdsWithValue(CustomField field,
                                          Option option)
Description copied from interface: MultipleSettableCustomFieldType
Returns a Set with of Long Objects representing the issue ids that the value has been set for

Specified by:
getIssueIdsWithValue in interface MultipleSettableCustomFieldType
Parameters:
field - the CustomField to search on
option - the Object representing a single value to search on.
Returns:
Set of Longs

getConfigurationItemTypes

public java.util.List getConfigurationItemTypes()
Description copied from interface: CustomFieldType
Returns a List of FieldConfigItemType objects. This opens up possibilties for configurable custom fields

Specified by:
getConfigurationItemTypes in interface CustomFieldType
Overrides:
getConfigurationItemTypes in class AbstractCustomFieldType
Returns:
List of FieldConfigItemType

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)
config - FieldConfig

getOptions

public Options getOptions(FieldConfig config,
                          JiraContextNode jiraContextNode)
Specified by:
getOptions in interface MultipleCustomFieldType

compare

public int compare(java.lang.String customFieldObjectValue1,
                   java.lang.String customFieldObjectValue2,
                   FieldConfig fieldConfig)
Description copied from interface: SortableCustomField
Compares the two custom field objects.

Specified by:
compare in interface SortableCustomField<java.lang.String>
Overrides:
compare in class TextCFType
Parameters:
customFieldObjectValue1 - Never null
customFieldObjectValue2 - Never null
Returns:
0, 1 or -1

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()

accept

public java.lang.Object accept(AbstractCustomFieldType.VisitorBase visitor)
Overrides:
accept in class TextCFType

getQueryForGroup

public org.apache.lucene.search.Query getQueryForGroup(java.lang.String fieldID,
                                                       java.lang.String groupName)
Description copied from interface: GroupSelectorField
This method should be implemented in your custom type to return a Query. Generally you should return a TermQuery in the form of fieldName:groupName. However some custom fields, such as (@Link SelectCFType) manipulate the field identifiers and values before storing in the index. In cases like this you will have to implement the method such that it searches the correct fields.

Specified by:
getQueryForGroup in interface GroupSelectorField
Parameters:
fieldID - the id of the custom field
groupName - the name of the group to filter on
Returns:
the (@Link Query) to pass to the searcher


Copyright © 2002-2010 Atlassian. All Rights Reserved.