Search in sources :

Example 1 with TimeLogEntryVO

use of net.sourceforge.processdash.log.time.TimeLogEntryVO in project processdash by dtuma.

the class RestoreIndivDataWorker method restoreTimeLogData.

private void restoreTimeLogData() throws IOException {
    // make a list of the time log entries that are already logged against
    // the project within the current dashboard.
    Set<Date> knownEntries = new HashSet();
    ModifiableTimeLog timeLog = (ModifiableTimeLog) ctx.getTimeLog();
    Iterator i = timeLog.filter(projectPrefix, null, null);
    while (i.hasNext()) {
        TimeLogEntry tle = (TimeLogEntry) i.next();
        knownEntries.add(tle.getStartTime());
    }
    // now scan the imported time log entries, and add any missing entries
    // to the time log.
    i = ImportedTimeLogManager.getInstance().getImportedTimeLogEntries(importPrefix);
    while (i.hasNext()) {
        TimeLogEntry tle = (TimeLogEntry) i.next();
        if (!knownEntries.contains(tle.getStartTime())) {
            String importedPath = tle.getPath();
            String hierPath = mapPathToHierarchy(importedPath, MapType.KeepExtra);
            TimeLogEntryVO newTle = new TimeLogEntryVO(timeLog.getNextID(), hierPath, tle.getStartTime(), tle.getElapsedTime(), tle.getInterruptTime(), tle.getComment(), ChangeFlagged.ADDED);
            timeLog.addModification(newTle);
        }
    }
}
Also used : ModifiableTimeLog(net.sourceforge.processdash.log.time.ModifiableTimeLog) TimeLogEntry(net.sourceforge.processdash.log.time.TimeLogEntry) Iterator(java.util.Iterator) TimeLogEntryVO(net.sourceforge.processdash.log.time.TimeLogEntryVO) Date(java.util.Date) HashSet(java.util.HashSet)

Aggregations

Date (java.util.Date)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 ModifiableTimeLog (net.sourceforge.processdash.log.time.ModifiableTimeLog)1 TimeLogEntry (net.sourceforge.processdash.log.time.TimeLogEntry)1 TimeLogEntryVO (net.sourceforge.processdash.log.time.TimeLogEntryVO)1