|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface CustomFieldType
This interface represents a particular type of CustomField
. It encapsulates all logic dealing with values
of a Custom Field, such as creation, update and removal of values, storage & retrieval of defaults and validation of
values.
A value instance of a custom field is represented as an Object
, from hereon in referred to as a
Transport Object. These may be of singular types (eg. Number
, String
) or
Multi-Dimensional (eg. Collection
of Strings, Map
of Date Objects, CustomFieldParams
of Option
). Most methods in the interface expect/returns Transfer Objects (e.g.
Persistence Methods (createValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object)
, updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object)
) and Transfer Object Getters
getValueFromIssue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue)
and getValueFromCustomFieldParams(com.atlassian.jira.issue.customfields.view.CustomFieldParams)
.
However, two special conversion methods (getSingularObjectFromString(java.lang.String)
& getStringFromSingularObject(java.lang.Object)
) act on the Singular Object level. Thus, even when the
Transfer Object type is a Collection of Number, getSingularObjectFromString would still return a single Number
object.
Implementing classes should clearly document the exact structure of the Transport Object in the
Class javadoc header. If the Transport Object is Multi-Dimensional, the type of the Singular Object should also be
specified. This is especially relevant for complex custom field types (See CascadingSelectCFType
for
example)
CustomField
,
CustomFieldParams
Field Summary | |
---|---|
static String |
DEFAULT_VALUE_TYPE
|
Method Summary | |
---|---|
String |
availableForBulkEdit(BulkEditBean bulkEditBean)
Allow the custom field type perform a specific check as to its availability for bulk editing. |
void |
createValue(CustomField field,
Issue issue,
Object value)
|
String |
getChangelogString(CustomField field,
Object value)
Returns a String of representing values to be stored in the change log, an example is the name of a version field that a version id will resolve to within JIRA. |
String |
getChangelogValue(CustomField field,
Object value)
Returns a values to be stored in the change log, example is the id of the changed item. |
List |
getConfigurationItemTypes()
Returns a List of FieldConfigItemType objects. |
Object |
getDefaultValue(FieldConfig fieldConfig)
Retrieves the Object representing the default CustomField value for the Custom Field. |
String |
getDescription()
|
CustomFieldTypeModuleDescriptor |
getDescriptor()
|
String |
getKey()
Returns the full key of the CustomFieldType. |
String |
getName()
|
List<FieldIndexer> |
getRelatedIndexers(CustomField customField)
Returns a list of indexers that will be used for the field. |
Object |
getSingularObjectFromString(String string)
Returns a Singular Object, given the string value as passed by the presentation tier. |
String |
getStringFromSingularObject(Object singularObject)
Returns the String representation of a single value within the CustomFieldType. |
Object |
getStringValueFromCustomFieldParams(CustomFieldParams parameters)
Return the String value object from the CustomFieldParams. |
Object |
getValueFromCustomFieldParams(CustomFieldParams parameters)
Retrieves the Object representing the CustomField value instance from the CustomFieldParams of Strings. |
Object |
getValueFromIssue(CustomField field,
Issue issue)
Retrieves the Object representing the current CustomField value for the given issue. |
Map<String,Object> |
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 |
init(CustomFieldTypeModuleDescriptor customFieldTypeModuleDescriptor)
Initialises the CustomFieldType with the given descriptor. |
boolean |
isRenderable()
This is a mirror of the method from the RenderableField interface and is needed to bridge the gap between CustomFields and CustomFieldTypes. |
Set<Long> |
remove(CustomField field)
Performs additional tasks when a CustomField of this type is being removed CustomField.remove() . |
void |
setDefaultValue(FieldConfig fieldConfig,
Object value)
Sets the default value for a Custom Field |
void |
updateValue(CustomField field,
Issue issue,
Object value)
|
void |
validateFromParams(CustomFieldParams relevantParams,
ErrorCollection errorCollectionToAddTo,
FieldConfig config)
Ensures that the CustomFieldParams of Strings is a valid representation of the Custom Field values. |
boolean |
valuesEqual(Object v1,
Object v2)
Used to compare 2 field values and work out whether a change item should be generated |
Field Detail |
---|
static final String DEFAULT_VALUE_TYPE
Method Detail |
---|
void init(CustomFieldTypeModuleDescriptor customFieldTypeModuleDescriptor)
customFieldTypeModuleDescriptor
- CustomFieldTypeModuleDescriptorString getKey()
String getName()
String getDescription()
CustomFieldTypeModuleDescriptor getDescriptor()
String getStringFromSingularObject(Object singularObject)
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
singularObject
- the object
Object getSingularObjectFromString(String string) throws FieldValidationException
string
- the String
FieldValidationException
- if the string is an invalid representation of the Object.Set<Long> remove(CustomField field)
CustomField.remove()
.
This includes removal of values & options.
field
- The custom field that is being removed, so any data stored for
any issues for that field can be deleted.
Set
of issue ids that has been affectedvoid validateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config)
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.
relevantParams
- parameter object of StringserrorCollectionToAddTo
- errorCollection to which any erros should be added (never null)config
- FieldConfigvoid createValue(CustomField field, Issue issue, Object value)
void updateValue(CustomField field, Issue issue, Object value)
Object getValueFromCustomFieldParams(CustomFieldParams parameters) throws FieldValidationException
createValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object)
, updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object)
) and Object returned from getValueFromIssue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue)
.
parameters
- CustomFieldParams of String objects. Will contain one value for Singular field types.
createValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object)
, updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object)
FieldValidationException
- if the String value fails to convert into ObjectscreateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object)
,
updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object)
,
getValueFromIssue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue)
Object getStringValueFromCustomFieldParams(CustomFieldParams parameters)
parameters
- - CustomFieldParams containing String values
Object getValueFromIssue(CustomField field, Issue issue)
getValueFromCustomFieldParams(com.atlassian.jira.issue.customfields.view.CustomFieldParams)
for more detailed notes.
field
- Custom field for which to retrieve the valueissue
- Issue from which to retrieve the value
createValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object)
, updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object)
getValueFromCustomFieldParams(com.atlassian.jira.issue.customfields.view.CustomFieldParams)
Object getDefaultValue(FieldConfig fieldConfig)
getValueFromCustomFieldParams(com.atlassian.jira.issue.customfields.view.CustomFieldParams)
for more detailed notes.
fieldConfig
- CustomField for default value
createValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object)
, updateValue(com.atlassian.jira.issue.fields.CustomField, com.atlassian.jira.issue.Issue, java.lang.Object)
void setDefaultValue(FieldConfig fieldConfig, Object value)
fieldConfig
- CustomField for which the default is being storedvalue
- Transport Object representing the value instance of the CustomFieldString getChangelogValue(CustomField field, Object value)
field
- CustomField that the value belongs tovalue
- Transport Object representing the value instance of the CustomField
String getChangelogString(CustomField field, Object value)
field
- CustomField that the value belongs tovalue
- Transport Object representing the value instance of the CustomField
Map<String,Object> getVelocityParameters(Issue issue, CustomField field, FieldLayoutItem fieldLayoutItem)
issue
- The issue currently in context (Note: this will be null in cases like 'default value')field
- CustomFieldfieldLayoutItem
- FieldLayoutItem
Map
of parameters to add to the velocity context, or an empty Map otherwise (never null)List getConfigurationItemTypes()
FieldConfigItemType
objects.
This opens up possibilties for configurable custom fields
FieldConfigItemType
List<FieldIndexer> getRelatedIndexers(CustomField customField)
customField
- the custom field to get the related indexers of.
FieldIndexer
objects. Null if no related indexers.boolean isRenderable()
boolean valuesEqual(Object v1, Object v2)
v1
- current valuev2
- new value
String availableForBulkEdit(BulkEditBean bulkEditBean)
bulkEditBean
- BulkEditBean
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |