com.atlassian.jira.issue.customfields.persistence
Class EagerLoadingOfBizCustomFieldPersister

java.lang.Object
  extended by com.atlassian.jira.issue.customfields.persistence.OfBizCustomFieldValuePersister
      extended by com.atlassian.jira.issue.customfields.persistence.EagerLoadingOfBizCustomFieldPersister
All Implemented Interfaces:
CustomFieldValuePersister

public class EagerLoadingOfBizCustomFieldPersister
extends OfBizCustomFieldValuePersister

Many times, the values for custom fields are all retrieved at the same time - such as viewing all values for an issue, or indexing all custom fields.

It therefore makes sense to eagerly loaded, reducing the number of database calls needed.


Field Summary
 
Fields inherited from class com.atlassian.jira.issue.customfields.persistence.OfBizCustomFieldValuePersister
DEFAULT_VALUE_ISSUE_ID, DEFAULT_VALUE_TYPE, delegator, ENTITY_CUSTOMFIELD_ID, ENTITY_ISSUE_ID, ENTITY_PARENT_KEY, ENTITY_VALUE_TYPE, FIELD_TYPE_DATE, FIELD_TYPE_NUMBER, FIELD_TYPE_STRING, FIELD_TYPE_TEXT, TABLE_CUSTOMFIELD_VALUE
 
Constructor Summary
EagerLoadingOfBizCustomFieldPersister(OfBizDelegator delegator)
           
 
Method Summary
 void createValues(CustomField field, Long issueId, PersistenceFieldType persistenceFieldType, Collection values)
           
 void createValues(CustomField field, Long issueId, PersistenceFieldType persistenceFieldType, Collection values, String parentKey)
           
protected  List getValuesForType(CustomField field, Long issueId)
           
protected  List<org.ofbiz.core.entity.GenericValue> getValuesForTypeAndParent(CustomField field, Long issueId, String parentKey)
           
 Set removeAllValues(String customFieldId)
          Called when removing a field.
 Set<Long> removeValue(CustomField field, Long issueId, PersistenceFieldType persistenceFieldType, Object value)
          Removes a specific custom field value for the given custom field, from a given issue, of a particular type.
 void updateValues(CustomField field, Long issueId, PersistenceFieldType persistenceFieldType, Collection values)
           
 void updateValues(CustomField field, Long issueId, PersistenceFieldType persistenceFieldType, Collection values, String parentKey)
           
 
Methods inherited from class com.atlassian.jira.issue.customfields.persistence.OfBizCustomFieldValuePersister
getIssueIdsWithValue, getValues, getValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EagerLoadingOfBizCustomFieldPersister

public EagerLoadingOfBizCustomFieldPersister(OfBizDelegator delegator)
Method Detail

createValues

public void createValues(CustomField field,
                         Long issueId,
                         PersistenceFieldType persistenceFieldType,
                         Collection values)
Specified by:
createValues in interface CustomFieldValuePersister
Overrides:
createValues in class OfBizCustomFieldValuePersister

createValues

public void createValues(CustomField field,
                         Long issueId,
                         PersistenceFieldType persistenceFieldType,
                         Collection values,
                         String parentKey)
Specified by:
createValues in interface CustomFieldValuePersister
Overrides:
createValues in class OfBizCustomFieldValuePersister

updateValues

public void updateValues(CustomField field,
                         Long issueId,
                         PersistenceFieldType persistenceFieldType,
                         Collection values)
Specified by:
updateValues in interface CustomFieldValuePersister
Overrides:
updateValues in class OfBizCustomFieldValuePersister

updateValues

public void updateValues(CustomField field,
                         Long issueId,
                         PersistenceFieldType persistenceFieldType,
                         Collection values,
                         String parentKey)
Specified by:
updateValues in interface CustomFieldValuePersister
Overrides:
updateValues in class OfBizCustomFieldValuePersister

removeValue

public Set<Long> removeValue(CustomField field,
                             Long issueId,
                             PersistenceFieldType persistenceFieldType,
                             Object value)
Description copied from interface: CustomFieldValuePersister
Removes a specific custom field value for the given custom field, from a given issue, of a particular type.

Specified by:
removeValue in interface CustomFieldValuePersister
Overrides:
removeValue in class OfBizCustomFieldValuePersister
Parameters:
field - the custom field.
issueId - the issue.
persistenceFieldType - the data type of the value
value - the value to delete.
Returns:
returns the set of ids of issues that were affected for some reason (should be 1, just the given issue!).

removeAllValues

public Set removeAllValues(String customFieldId)
Description copied from interface: CustomFieldValuePersister
Called when removing a field. Removes all the customfield values linked to the customfield Id provided.

Specified by:
removeAllValues in interface CustomFieldValuePersister
Overrides:
removeAllValues in class OfBizCustomFieldValuePersister
Parameters:
customFieldId - the id of the custom field
Returns:
issue IDs affected.

getValuesForTypeAndParent

protected List<org.ofbiz.core.entity.GenericValue> getValuesForTypeAndParent(CustomField field,
                                                                             Long issueId,
                                                                             String parentKey)
Overrides:
getValuesForTypeAndParent in class OfBizCustomFieldValuePersister

getValuesForType

protected List getValuesForType(CustomField field,
                                Long issueId)
Overrides:
getValuesForType in class OfBizCustomFieldValuePersister


Copyright © 2002-2012 Atlassian. All Rights Reserved.