org.activemath.webapp.report
Class ReportUtils

java.lang.Object
  extended by org.activemath.webapp.report.ReportUtils

public final class ReportUtils
extends Object


Nested Class Summary
static class ReportUtils.CSVEscaper
          This class provides methods supporting CSV exporting of report data.
 
Field Summary
protected static Logger log
           
 
Constructor Summary
ReportUtils()
           
 
Method Summary
static BookStat calculateBookStat(String userId, String bookId)
          Calculates the BookStat for an user and a book
static Map<String,ExerciseRun> generateExerciseRuns(List<ActivemathEvent> eventList)
          Generate exercise runs for a given list of events, containing (at least) events of the types "ExerciseStarted", "ExerciseStep" and "ExerciseFinished"
static ReportUtils.CSVEscaper getCsvEscape()
           
static List<ActivemathEvent> getEvents(long startTime, long endTime, Collection<String> includeEvents, Collection<String> excludeEvents, Collection<String> itemIds, Collection<String> includeUsers, Collection<String> excludeUsers, Collection<String> groupIds, Collection<String> bookIds)
          Query history for all ActivemathEvents matching the specified criteria
static List<String> getItems(String bookId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static Logger log
Constructor Detail

ReportUtils

public ReportUtils()
Method Detail

getEvents

public static final List<ActivemathEvent> getEvents(long startTime,
                                                    long endTime,
                                                    Collection<String> includeEvents,
                                                    Collection<String> excludeEvents,
                                                    Collection<String> itemIds,
                                                    Collection<String> includeUsers,
                                                    Collection<String> excludeUsers,
                                                    Collection<String> groupIds,
                                                    Collection<String> bookIds)
Query history for all ActivemathEvents matching the specified criteria

Parameters:
startTime - Marks the beginning of the period in which to query
endTime - Marks the end of the period in which to query
includeEvents - Whitelist of event types to include (e.g. "ExerciseStarted")
excludeEvents - Blacklist of event types to exclude (e.g. "FocusChanged")
itemIds - IDs of specific items for which to query
includeUsers - IDs of specific users for which to query
usersExcluded -
groupId - IDs of specific group for which to query
bookId - ID of specific book for which to query
Returns:
A list of all ActivemathEvents matching the specified criteria

generateExerciseRuns

public static final Map<String,ExerciseRun> generateExerciseRuns(List<ActivemathEvent> eventList)
Generate exercise runs for a given list of events, containing (at least) events of the types "ExerciseStarted", "ExerciseStep" and "ExerciseFinished"

Parameters:
eventList - A list which contains all relevant events
Returns:
A map of event id -> ExerciseRun, where the ID is taken from the opening ExerciseStarted event of the exercise run

getItems

public static final List<String> getItems(String bookId)

getCsvEscape

public static ReportUtils.CSVEscaper getCsvEscape()

calculateBookStat

public static BookStat calculateBookStat(String userId,
                                         String bookId)
Calculates the BookStat for an user and a book

Parameters:
userId -
bookId -
Returns:
BookStat or null if something has gone wrong or there is no data.