com.atlassian.jira.project.statistics.type
Class AbstractFieldStatisticType

java.lang.Object
  extended bycom.atlassian.jira.project.statistics.type.AbstractStatisticType
      extended bycom.atlassian.jira.project.statistics.type.AbstractFieldStatisticType
All Implemented Interfaces:
java.util.Comparator, StatisticType
Direct Known Subclasses:
TypeStatus

public abstract class AbstractFieldStatisticType
extends AbstractStatisticType

This is an abstract class that contains some common functionality for Constant StatisticTypes.(Ones that are not Node Associated). Each StatisticType that is not Node Associated should extend this class


Field Summary
 
Fields inherited from interface com.atlassian.jira.project.statistics.StatisticType
OPEN_BY_AFFECTED_VERSION, OPEN_BY_ASSIGNEE, OPEN_BY_COMPONENT, OPEN_BY_FIX_VERSION, OPEN_BY_PRIORITY, STATUS
 
Constructor Summary
AbstractFieldStatisticType()
           
 
Method Summary
 void amendCollection(StatisticCollection statisticCollection, StatisticsUpdateEvent event)
          Amends the StatisticCollection dependent on the value of the StatisticsUpdateEvent
protected  void amendCollectionForCreate(StatisticCollection statisticsCollection, StatisticsUpdateEvent event)
          Amend the StatisticCollection for a create StatisticsUpdateEvent.
protected  void amendCollectionForUpdate(StatisticCollection statCollection, StatisticsUpdateEvent event)
          Updates the StatisticCollection based on the values of the changegroup.
 int compare(java.lang.Object o1, java.lang.Object o2)
          Alphatetic Comparator to sort 2 objects alphabetically
 boolean equals(java.lang.Object o)
           
protected abstract  java.lang.String getChangeItemName()
          This is the name of the field that will appear in the ChangeItem.
protected  java.util.Collection getEntities(ProjectStatistics projectStatistics)
           
protected  java.util.List getExpressions(GenericValue project, GenericValue securityLevel)
          Return any extra expressions to filter the list of issues.
protected abstract  java.lang.String getIssueField(GenericValue issue)
           
protected  java.util.Collection getIssues(ProjectStatistics projectStats, GenericValue securityLevel, java.lang.Object entity)
           
protected  java.lang.String getKey(GenericValue issue, java.lang.Object entity)
           
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class com.atlassian.jira.project.statistics.type.AbstractStatisticType
calculateStatisticsCollection, decrementStatisticInCollection, decrementStatisticInCollectionWithSecurityType, getFieldName, incrementStatisticInCollection, incrementStatisticInCollectionWithSecurityType, isResolved
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractFieldStatisticType

public AbstractFieldStatisticType()
Method Detail

getChangeItemName

protected abstract java.lang.String getChangeItemName()
This is the name of the field that will appear in the ChangeItem.


getExpressions

protected java.util.List getExpressions(GenericValue project,
                                        GenericValue securityLevel)
Return any extra expressions to filter the list of issues.

If there are no expressions, return an empty list.


getEntities

protected java.util.Collection getEntities(ProjectStatistics projectStatistics)
                                    throws GenericEntityException
Specified by:
getEntities in class AbstractStatisticType
Throws:
GenericEntityException

getIssues

protected java.util.Collection getIssues(ProjectStatistics projectStats,
                                         GenericValue securityLevel,
                                         java.lang.Object entity)
                                  throws GenericEntityException
Specified by:
getIssues in class AbstractStatisticType
Throws:
GenericEntityException

getKey

protected java.lang.String getKey(GenericValue issue,
                                  java.lang.Object entity)
Specified by:
getKey in class AbstractStatisticType

getIssueField

protected abstract java.lang.String getIssueField(GenericValue issue)

amendCollection

public void amendCollection(StatisticCollection statisticCollection,
                            StatisticsUpdateEvent event)
                     throws StatisticOutOfDateException
Description copied from interface: StatisticType
Amends the StatisticCollection dependent on the value of the StatisticsUpdateEvent

Throws:
StatisticOutOfDateException

amendCollectionForCreate

protected void amendCollectionForCreate(StatisticCollection statisticsCollection,
                                        StatisticsUpdateEvent event)
                                 throws StatisticOutOfDateException
Amend the StatisticCollection for a create StatisticsUpdateEvent.

This will normally happen when an issue is created. The Statistic object for that corresponding fieldname is then incremented. If the Statistic did not exist it is created with a value of 1.

Throws:
StatisticOutOfDateException

amendCollectionForUpdate

protected void amendCollectionForUpdate(StatisticCollection statCollection,
                                        StatisticsUpdateEvent event)
                                 throws StatisticOutOfDateException
Updates the StatisticCollection based on the values of the changegroup.

The ChangeItems for the ChangeGroup are iterated. If the changeitem matches this StatisticType then the Statistic of the changeitems oldvalue is decremented by 1. If the value of the Statistic after this decrement is 0 then it is removed from the StatisticCollection

The Statistic of the changeitems newvalue is retrieved. If this exists then the value id incremented by 1. If this doesnt exist then it is created and added to the StatisticCollection with a value of 1.

Throws:
StatisticOutOfDateException
See Also:
StatisticCollection.addStatistic(com.atlassian.jira.project.statistics.Statistic), Statistic.addIssue(Long), Statistic.addIssue(Long)

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Alphatetic Comparator to sort 2 objects alphabetically


equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()

toString

public java.lang.String toString()