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:
CustomFieldType, GroupSelectorField, MultipleCustomFieldType, MultipleSettableCustomFieldType, SortableCustomField

public class SelectCFType
extends TextCFType
implements MultipleSettableCustomFieldType, MultipleCustomFieldType, SortableCustomField, GroupSelectorField


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
 int compare(Object customFieldObjectValue1, Object customFieldObjectValue2, FieldConfig fieldConfig)
          Comapares the two custom field objects.
 List getConfigurationItemTypes()
          Returns a List of FieldConfigItemType objects.
 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)
           
 Object getSingularObjectFromString(String string)
          Returns a Singular Object, given the string value as passed by the presentation tier.
 String getStringFromSingularObject(Object value)
          Returns the String representation of a single value within the CustomFieldType.
protected  SearchParameter makeSearchParameter(CustomField field, String paramValue, String paramPrefix)
           
 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 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 Object getSingularObjectFromString(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
Returns:
singularObject instance
Throws:
FieldValidationException

getStringFromSingularObject

public String getStringFromSingularObject(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
Returns:
String representation of the Object

getIssueIdsWithValue

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

makeSearchParameter

protected SearchParameter makeSearchParameter(CustomField field,
                                              String paramValue,
                                              String paramPrefix)
Overrides:
makeSearchParameter in class StringCFType

getOptions

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

compare

public int compare(Object customFieldObjectValue1,
                   Object customFieldObjectValue2,
                   FieldConfig fieldConfig)
Description copied from interface: SortableCustomField
Comapares the two custom field objects.

Specified by:
compare in interface SortableCustomField
Overrides:
compare in class TextCFType
Parameters:
customFieldObjectValue1 - Never null
customFieldObjectValue2 - Never null
Returns:
0, 1 or -1


Copyright © 2002-2007 Atlassian. All Rights Reserved.