com.atlassian.jira.project.statistics
Interface StatisticsManager

All Known Implementing Classes:
StatisticsManagerImpl

public interface StatisticsManager

Atlassian Source Code Template. User: Bobby Date: Apr 24, 2003 Time: 5:37:51 PM CVS Revision: Revision$ Last CVS Commit: Date$ Author of last CVS Commit: Author$


Field Summary
static int CREATE_EVENT
           
static int DELETE_EVENT
           
static int MOVE_EVENT
           
static int UPDATE_EVENT
           
 
Method Summary
 java.util.Map getAllStatistics()
          Returns a Map containing the Statistics for all projects that have had their statistics loaded.
 StatisticCollection getStatistics(GenericValue securityLevel, StatisticType statisticType, GenericValue project)
          Get the StatisticCollection for this StatisticType, security level and project.
 long getTotalStatistics(StatisticType statisticType, java.lang.String key, GenericValue project)
          Get the total statistical value for this StatisticType, key and project.
 java.util.Map getTypes()
          Returns a Map containing all the StatisticType objects that have been loaded
 long getUsersTotalStatistics(User user, StatisticType statisticType, java.lang.String key, GenericValue project)
           
 void loadStatisticsForAllProjects()
          Load all the statistics for every project into this StatisticsManagerImpl.
 ProjectStatistics refreshProjectStatistics(GenericValue project)
          Refresh the Statistics for a given project
 void updateStatistics(StatisticsUpdateEvent event)
          Updates the Statistics based on an issue and its changegroup.
 

Field Detail

CREATE_EVENT

public static final int CREATE_EVENT
See Also:
Constant Field Values

UPDATE_EVENT

public static final int UPDATE_EVENT
See Also:
Constant Field Values

DELETE_EVENT

public static final int DELETE_EVENT
See Also:
Constant Field Values

MOVE_EVENT

public static final int MOVE_EVENT
See Also:
Constant Field Values
Method Detail

loadStatisticsForAllProjects

public void loadStatisticsForAllProjects()
Load all the statistics for every project into this StatisticsManagerImpl.

If you want to pre-cache all statistics, call this method straight after constructing a StatisticsManager.

Alternatively if you want to lazy load statistics, don't call loadStatisticsForAllProjects() and the first time statistics for a particular project are accessed, they will be loaded.


getStatistics

public StatisticCollection getStatistics(GenericValue securityLevel,
                                         StatisticType statisticType,
                                         GenericValue project)
Get the StatisticCollection for this StatisticType, security level and project.

First the ProjectStatistics will be retrieved for this project and from this the StatisticCollection for this security level and StatisticType will be returned


getTypes

public java.util.Map getTypes()
Returns a Map containing all the StatisticType objects that have been loaded


getAllStatistics

public java.util.Map getAllStatistics()
Returns a Map containing the Statistics for all projects that have had their statistics loaded.

If loadStatisticsForAllProjects() has been called then this map will contain the Statistics for all Projects.


refreshProjectStatistics

public ProjectStatistics refreshProjectStatistics(GenericValue project)
Refresh the Statistics for a given project

The ProjectStatistics object for the given project is removed from the Project Statistics Map and then they are recalculated and added again


updateStatistics

public void updateStatistics(StatisticsUpdateEvent event)
                      throws GenericEntityException
Updates the Statistics based on an issue and its changegroup.

This method gets the ProjectStatistics object based on the project of the issue passed in. UpdateStatistics is then called on this object

Throws:
GenericEntityException
See Also:
ProjectStatistics.updateStatistics(com.atlassian.jira.project.statistics.StatisticsUpdateEvent)

getTotalStatistics

public long getTotalStatistics(StatisticType statisticType,
                               java.lang.String key,
                               GenericValue project)
Get the total statistical value for this StatisticType, key and project. For example the Statistics for OpenByAssignee for "joe" in Project X

The ProjectStatistics object for this project is retrieved. For each SecurityStatistic in this ProjectStatistics, the StatisticCollection object for this StatisticType is retrieved. The value of the Statistic object with this key is taken from the StatisticCollection and added to the total.


getUsersTotalStatistics

public long getUsersTotalStatistics(User user,
                                    StatisticType statisticType,
                                    java.lang.String key,
                                    GenericValue project)
                             throws StatisticException
Throws:
StatisticException