|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.issue.customfields.impl.AbstractCustomFieldType com.atlassian.jira.issue.customfields.impl.AbstractSingleFieldType
A abstract class that simplifies creating a CustomField that stores a single values via ofbiz. Possible values to store are:
FIELD_TYPE_STRING
FIELD_TYPE_TEXT
FIELD_TYPE_NUMBER
FIELD_TYPE_DATE
User
or a GenericValue
representing a project.
Field Summary | |
protected CustomFieldPersister |
customFieldPersister
|
protected static java.lang.String |
FIELD_TYPE_DATE
|
protected static java.lang.String |
FIELD_TYPE_NUMBER
|
protected static java.lang.String |
FIELD_TYPE_STRING
|
protected static java.lang.String |
FIELD_TYPE_TEXT
|
Constructor Summary | |
protected |
AbstractSingleFieldType(CustomFieldPersister customFieldPersister)
|
Method Summary | |
void |
createValue(CustomField field,
org.ofbiz.core.entity.GenericValue issue,
java.lang.Object value)
at this point we know that the value doesn't exist, and that |
java.lang.String |
getChangelogValue(CustomField field,
java.lang.Object value)
Returns a String of representing values to be stored in the change log. |
protected abstract PersistenceFieldType |
getDatabaseType()
|
protected abstract java.lang.Object |
getDbValueFromObject(java.lang.Object customFieldObject)
Returns the database representation of the Java object as stored for that CustomField. |
java.lang.Object |
getDefaultValue(CustomField field)
Retrieves the Object representing the default CustomField value for the Custom Field. |
protected abstract java.lang.Object |
getObjectFromDbValue(java.lang.Object databaseValue)
Returns the Domain Object or GenericValue object representing the given Custom Field value as stored in the database |
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.Set |
remove(CustomField field)
called when removing a field. |
void |
setDefaultValue(CustomField field,
java.lang.Object value)
Sets the default value for a Custom Field |
void |
updateValue(CustomField customField,
org.ofbiz.core.entity.GenericValue issue,
java.lang.Object value)
the value does exist, and the new value is different than the existing one. |
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.AbstractCustomFieldType |
assertObjectImplementsType, getDescription, getDescriptor, getKey, getName, getVelocityParameters, 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.CustomFieldType |
getSingularObjectFromString, getStringFromSingularObject |
Field Detail |
protected static final java.lang.String FIELD_TYPE_STRING
protected static final java.lang.String FIELD_TYPE_TEXT
protected static final java.lang.String FIELD_TYPE_DATE
protected static final java.lang.String FIELD_TYPE_NUMBER
protected final CustomFieldPersister customFieldPersister
Constructor Detail |
protected AbstractSingleFieldType(CustomFieldPersister customFieldPersister)
Method Detail |
public java.lang.Object getValueFromIssue(CustomField field, org.ofbiz.core.entity.GenericValue issue)
CustomFieldType
CustomFieldType.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
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.getValueFromCustomFieldParams(com.atlassian.jira.issue.customfields.view.CustomFieldParams)
public java.util.Set remove(CustomField field)
Subclasses should override this if they have specific cleanup that they need to do (such as removing select list values)
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 affectedpublic void createValue(CustomField field, org.ofbiz.core.entity.GenericValue issue, java.lang.Object value)
public void updateValue(CustomField customField, org.ofbiz.core.entity.GenericValue issue, java.lang.Object value)
public void setDefaultValue(CustomField field, java.lang.Object value)
CustomFieldType
field
- CustomField for which the default is being storedvalue
- Transport Object representing the value instance of the CustomFieldpublic java.lang.Object getDefaultValue(CustomField field)
CustomFieldType
CustomFieldType.getValueFromCustomFieldParams(com.atlassian.jira.issue.customfields.view.CustomFieldParams)
for more detailed notes.
field
- CustomField for default value
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)
public void validateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo)
CustomFieldType
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)public java.lang.Object getValueFromCustomFieldParams(CustomFieldParams relevantParams) throws CustomFieldValidationException
CustomFieldType
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)
.
relevantParams
- CustomFieldParams of String objects. Will contain one value for Singular field types.
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)
CustomFieldValidationException
- if the String value fails to convert into ObjectsCustomFieldType.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)
public java.lang.String getChangelogValue(CustomField field, java.lang.Object value)
CustomFieldType
field
- CustomField that the value belongs tovalue
- Transport Object representing the value instance of the CustomField
protected abstract PersistenceFieldType getDatabaseType()
protected abstract java.lang.Object getDbValueFromObject(java.lang.Object customFieldObject)
customFieldObject
-
protected abstract java.lang.Object getObjectFromDbValue(java.lang.Object databaseValue) throws CustomFieldValidationException
databaseValue
- - String, Double or Date objects
CustomFieldValidationException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |