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

java.lang.Object
  extended by com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
      extended by com.atlassian.jira.issue.customfields.impl.AbstractMultiSettableCFType
          extended by com.atlassian.jira.issue.customfields.impl.CascadingSelectCFType
All Implemented Interfaces:
CustomFieldType, MultipleCustomFieldType, MultipleSettableCustomFieldType

public class CascadingSelectCFType
extends AbstractMultiSettableCFType
implements MultipleSettableCustomFieldType

Cascading Select Custom Field Type allows for multiple dependent select lists.

Transport Object Type
CustomFieldParams The key in the CustomFieldParams object represents the field depth of the select list. eg. a key of null is the root parent, and key of "1" is the first level select list. As at JIRA 3.0, there can only be one level.
Singular Object Type
Option


Field Summary
static PersistenceFieldType CASCADE_VALUE_TYPE
           
protected static java.lang.String ENTITY_ISSUE_ID
           
 
Fields inherited from class com.atlassian.jira.issue.customfields.impl.AbstractMultiSettableCFType
customFieldPersister, optionsManager
 
Constructor Summary
CascadingSelectCFType(OptionsManager optionsManager, CustomFieldPersister customFieldPersister)
           
 
Method Summary
 void createValue(CustomField field, org.ofbiz.core.entity.GenericValue issue, java.lang.Object value)
          These methods take the Transport Object as a parameter
 java.lang.String getChangelogValue(CustomField field, java.lang.Object value)
          Returns a String of representing values to be stored in the change log.
 java.lang.Object getDefaultValue(CustomField field)
          Retrieves the Object representing the default CustomField value for the Custom Field.
 java.util.Set getIssueIdsWithValue(CustomField field, Option option)
          Returns a list of Issue Ids matching the "value" note that the value in this instance is the single object
 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 optionObject)
          Returns the String representation of a single value within the CustomFieldType.
 java.lang.Object getValueFromCustomFieldParams(CustomFieldParams relevantParams)
          Retrieves the Object representing the CustomField value instance from the CustomFieldParams of Strings.
 java.lang.Object getValueFromIssue(CustomField field, org.ofbiz.core.entity.GenericValue issue)
          Retrieves the Object representing the current CustomField value for the given issue.
 java.util.Map getVelocityParameters(org.ofbiz.core.entity.GenericValue issue)
          The custom field may wish to pass parameters to the velocity context beyond the getValueFromIssue methods (eg managers).
 void removeValue(CustomField field, org.ofbiz.core.entity.GenericValue issue, Option option)
           
 void setDefaultValue(CustomField customField, java.lang.Object value)
          Sets the default value for a Custom Field
 void updateValue(CustomField field, org.ofbiz.core.entity.GenericValue issue, java.lang.Object value)
           
 void validateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo)
          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.AbstractMultiSettableCFType
getOptions, remove
 
Methods inherited from class com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType
assertObjectImplementsType, getDescription, getDescriptor, getKey, getName, init
 
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.MultipleCustomFieldType
getOptions
 
Methods inherited from interface com.atlassian.jira.issue.customfields.CustomFieldType
getDescription, getDescriptor, getKey, getName, init, remove
 

Field Detail

CASCADE_VALUE_TYPE

public static final PersistenceFieldType CASCADE_VALUE_TYPE

ENTITY_ISSUE_ID

protected static final java.lang.String ENTITY_ISSUE_ID
See Also:
Constant Field Values
Constructor Detail

CascadingSelectCFType

public CascadingSelectCFType(OptionsManager optionsManager,
                             CustomFieldPersister customFieldPersister)
Method Detail

validateFromParams

public void validateFromParams(CustomFieldParams relevantParams,
                               ErrorCollection errorCollectionToAddTo)
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
Parameters:
relevantParams - parameter object of Strings
errorCollectionToAddTo - errorCollection to which any erros should be added (never null)

createValue

public void createValue(CustomField field,
                        org.ofbiz.core.entity.GenericValue issue,
                        java.lang.Object value)
Description copied from interface: CustomFieldType
These methods take the Transport Object as a parameter

Specified by:
createValue in interface CustomFieldType

updateValue

public void updateValue(CustomField field,
                        org.ofbiz.core.entity.GenericValue issue,
                        java.lang.Object value)
Specified by:
updateValue in interface CustomFieldType

removeValue

public void removeValue(CustomField field,
                        org.ofbiz.core.entity.GenericValue issue,
                        Option option)
Specified by:
removeValue in interface MultipleSettableCustomFieldType

getValueFromIssue

public java.lang.Object getValueFromIssue(CustomField field,
                                          org.ofbiz.core.entity.GenericValue issue)
Description copied from interface: CustomFieldType
Retrieves the Object representing the current CustomField value for the given issue. See CustomFieldType.getValueFromCustomFieldParams(com.atlassian.jira.issue.customfields.view.CustomFieldParams) for more detailed notes.

Specified by:
getValueFromIssue in interface CustomFieldType
Parameters:
field - Custom field for which to retrieve the value
issue - Issue from which to retrieve the value
Returns:
Transport Object matching the Object parameter of CustomFieldType.createValue(com.atlassian.jira.issue.fields.CustomField, org.ofbiz.core.entity.GenericValue, java.lang.Object), CustomFieldType.updateValue(com.atlassian.jira.issue.fields.CustomField, org.ofbiz.core.entity.GenericValue, java.lang.Object)
See Also:
CustomFieldType.getValueFromCustomFieldParams(com.atlassian.jira.issue.customfields.view.CustomFieldParams)

getValueFromCustomFieldParams

public java.lang.Object getValueFromCustomFieldParams(CustomFieldParams relevantParams)
                                               throws CustomFieldValidationException
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, org.ofbiz.core.entity.GenericValue, java.lang.Object), CustomFieldType.updateValue(com.atlassian.jira.issue.fields.CustomField, org.ofbiz.core.entity.GenericValue, java.lang.Object)) and Object returned from CustomFieldType.getValueFromIssue(com.atlassian.jira.issue.fields.CustomField, org.ofbiz.core.entity.GenericValue).

Specified by:
getValueFromCustomFieldParams in interface CustomFieldType
Parameters:
relevantParams - 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, org.ofbiz.core.entity.GenericValue, java.lang.Object), CustomFieldType.updateValue(com.atlassian.jira.issue.fields.CustomField, org.ofbiz.core.entity.GenericValue, java.lang.Object)
Throws:
CustomFieldValidationException - if the String value fails to convert into Objects
See Also:
CustomFieldType.createValue(com.atlassian.jira.issue.fields.CustomField, org.ofbiz.core.entity.GenericValue, java.lang.Object), CustomFieldType.updateValue(com.atlassian.jira.issue.fields.CustomField, org.ofbiz.core.entity.GenericValue, java.lang.Object), CustomFieldType.getValueFromIssue(com.atlassian.jira.issue.fields.CustomField, org.ofbiz.core.entity.GenericValue)

getDefaultValue

public java.lang.Object getDefaultValue(CustomField field)
Description copied from interface: CustomFieldType
Retrieves the Object representing the default CustomField value for the Custom Field. See CustomFieldType.getValueFromCustomFieldParams(com.atlassian.jira.issue.customfields.view.CustomFieldParams) for more detailed notes.

Specified by:
getDefaultValue in interface CustomFieldType
Parameters:
field - CustomField for default value
Returns:
Transport Object matching the Object parameter of CustomFieldType.createValue(com.atlassian.jira.issue.fields.CustomField, org.ofbiz.core.entity.GenericValue, java.lang.Object), CustomFieldType.updateValue(com.atlassian.jira.issue.fields.CustomField, org.ofbiz.core.entity.GenericValue, java.lang.Object)

setDefaultValue

public void setDefaultValue(CustomField customField,
                            java.lang.Object value)
Description copied from interface: CustomFieldType
Sets the default value for a Custom Field

Specified by:
setDefaultValue in interface CustomFieldType
Parameters:
customField - CustomField for which the default is being stored
value - Transport Object representing the value instance of the CustomField

getChangelogValue

public java.lang.String getChangelogValue(CustomField field,
                                          java.lang.Object value)
Description copied from interface: CustomFieldType
Returns a String of representing values to be stored in the change log.

Specified by:
getChangelogValue in interface CustomFieldType
Parameters:
field - CustomField that the value belongs to
value - Transport Object representing the value instance of the CustomField
Returns:
Change log string.

getIssueIdsWithValue

public java.util.Set getIssueIdsWithValue(CustomField field,
                                          Option option)
Returns a list of Issue Ids matching the "value" note that the value in this instance is the single object

Specified by:
getIssueIdsWithValue in interface MultipleSettableCustomFieldType
Parameters:
field -
option -
Returns:

getStringFromSingularObject

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

getSingularObjectFromString

public java.lang.Object getSingularObjectFromString(java.lang.String string)
                                             throws CustomFieldValidationException
Description copied from interface: CustomFieldType
Returns a Singular Object, given the string value as passed by the presentation tier. Throws CustomFieldValidationException if the string is an invalid representation of the Object.

Specified by:
getSingularObjectFromString in interface CustomFieldType
Returns:
singularObject instance
Throws:
CustomFieldValidationException

getVelocityParameters

public java.util.Map getVelocityParameters(org.ofbiz.core.entity.GenericValue issue)
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)


Copyright © 2002-2006 Atlassian. All Rights Reserved.