Added findEntriesToRecategorize() to CategorizationPlan Refactored createNewCategory() to newCategory() on CategorizationPlan Refactored Category to use CategorizationPlans Created CatPlan for DescriptionBasedCategory Made Event cloneable. Refactored Category implementations to be aware of the single arg Category constructor. Created TwoLevelCategory, for entries which inherently have two levels of categorization in them. Created a CatPlan for TwoLevelCategory Removed the specialization implementation, ITHelpCategory: the new TwoLevelCategory is a more general version of the same. Created CatPlan for TicketCategory Fixed TicketCategory and TicketPlan to adjust for small difference between the old behavour of ITHelpCategory and new TwoLevelCategory Updated testing starter script.
57 lines
1.9 KiB
Groovy
57 lines
1.9 KiB
Groovy
import com.jdbernard.timeanalyzer.*
|
|
import com.jdbernard.timestamper.core.*
|
|
import com.quantumdigital.ithelp.timeanalyzer.*
|
|
import org.joda.time.*
|
|
import org.joda.time.format.*
|
|
import org.jfree.chart.*
|
|
import org.jfree.data.general.*
|
|
import org.jfree.util.SortOrder
|
|
|
|
tep = new TimelineEventProcessor()
|
|
tep.exclusions << ~/Going Home/
|
|
|
|
pf = PeriodFormat.getDefault()
|
|
|
|
fileSource = new FileTimelineSource(new File("timeline.jdbernard.txt").toURI())
|
|
timeline = fileSource.read()
|
|
events = tep.process(timeline)
|
|
|
|
topcat = new FilteredCategory("Top Category")
|
|
topcat.filters << new TimeIntervalCategoryFilter(
|
|
new DateTime(2011, 1, 2, 0, 0, 0, 0), new DateTime(2011, 1, 9, 0, 0, 0, 0))
|
|
|
|
twoLevelCatPlan = new TwoLevelCategorizationPlan()
|
|
descriptionBasedCatPlan = new DescriptionBasedCategorizationPlan()
|
|
topcat.categorizationPlans << twoLevelCatPlan
|
|
topcat.categorizationPlans << descriptionBasedCatPlan
|
|
|
|
ithelpcat = new TwoLevelCategory("ITHelp")
|
|
ticketCatPlan = new TicketCategorizationPlan()
|
|
|
|
ithelpcat.categorizationPlans << ticketCatPlan
|
|
ithelpcat.categorizationPlans << descriptionBasedCatPlan
|
|
|
|
topcat.categories << ithelpcat
|
|
|
|
//events.each { if (topcat.matchesEvent(it)) topcat.addEvent(it) }
|
|
|
|
makePieDataset = { category ->
|
|
DefaultPieDataset dpds = new DefaultPieDataset()
|
|
category.categories.each { cat ->
|
|
dpds.setValue(cat.description, cat.duration.standardSeconds) }
|
|
category.entries.each { entry ->
|
|
dpds.setValue(entry.description, entry.duration.standardSeconds) }
|
|
dpds.sortByValues(SortOrder.DESCENDING)
|
|
|
|
return dpds
|
|
}
|
|
|
|
//topcatDataset = makePieDataset(topcat)
|
|
//ithelpDataset = makePieDataset(ithelpcat)
|
|
|
|
//topcatFrame = new ChartFrame("Top Category",
|
|
//ChartFactory.createPieChart("Time Spent", topcatDataset, true, true, false))
|
|
//ithelpFrame = new ChartFrame("ITHelp",
|
|
//ChartFactory.createPieChart("Time Spent", ithelpDataset, true, true, false))
|
|
|