use of net.sourceforge.processdash.util.EnumerIterator in project processdash by dtuma.
the class EVWeekReport method getActualTimeSpentIndiv.
private void getActualTimeSpentIndiv(Map<String, Map<String, Double>> result, Date fromDate, Date toDate) {
// scan the time log and gather up the actual time spent per task
Map<String, Double> actualTimes = new HashMap();
try {
EnumerIterator timeLogEntries = getDashboardContext().getTimeLog().filter(null, fromDate, toDate);
while (timeLogEntries.hasNext()) {
TimeLogEntry tle = (TimeLogEntry) timeLogEntries.next();
String path = tle.getPath();
double time = tle.getElapsedTime();
sumActualTime(actualTimes, path, time);
}
} catch (IOException e) {
}
result.put(getOwner(), actualTimes);
}
use of net.sourceforge.processdash.util.EnumerIterator in project processdash by dtuma.
the class TimeLogModifications method filter.
public EnumerIterator filter(String path, Date from, Date to) throws IOException {
if (isEmpty())
// optimization if there are no modifications to perform
return parent.filter(path, from, to);
Iterator baseEntries = parent.filter(null, null, null);
Iterator modifiedEntries = new ModifiedEntriesFilter(baseEntries);
Iterator addedEntries = new AddedEntriesFilter();
EnumerIterator allEntries = new IteratorConcatenator(modifiedEntries, addedEntries);
if (path == null && from == null && to == null)
return allEntries;
else
return new TimeLogIteratorFilter(allEntries, path, from, to);
}
use of net.sourceforge.processdash.util.EnumerIterator in project processdash by dtuma.
the class TimeLogIOTest method testOldStyleBoundaryCases.
public void testOldStyleBoundaryCases() throws Exception {
// nonexistent file
EnumerIterator iter = new OldStyleTimeLogReader(new File("foo"), new DummyIDSource());
assertFalse(iter.hasNext());
assertFalse(iter.hasMoreElements());
try {
iter.next();
fail("Expected NoSuchElementException");
} catch (NoSuchElementException nsee) {
}
try {
iter.nextElement();
fail("Expected NoSuchElementException");
} catch (NoSuchElementException nsee) {
}
try {
iter.remove();
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException nsee) {
}
try {
iter = new OldStyleTimeLogReader(new IOExceptionInputStream(openFile(TIMELOG1_TXT), 200));
fail("Expected IOException");
} catch (IOException ioe) {
}
try {
iter = new OldStyleTimeLogReader(new IOExceptionInputStream(openFile(TIMELOG1_TXT), 10000));
while (iter.hasNext()) iter.next();
fail("Expected IONoSuchElementException");
} catch (IONoSuchElementException ionsee) {
// expected behavior
} catch (IOException ioe) {
fail("Expected IONoSuchElementException");
}
}
use of net.sourceforge.processdash.util.EnumerIterator in project processdash by dtuma.
the class TimeLogIOTest method testNewStyleBoundaryCases.
public void testNewStyleBoundaryCases() throws Exception {
// nonexistent file
EnumerIterator iter = new TimeLogReader(new File("foo"));
assertFalse(iter.hasNext());
assertFalse(iter.hasMoreElements());
try {
iter.next();
fail("Expected NoSuchElementException");
} catch (NoSuchElementException nsee) {
}
try {
iter.nextElement();
fail("Expected NoSuchElementException");
} catch (NoSuchElementException nsee) {
}
try {
iter.remove();
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException nsee) {
}
}
use of net.sourceforge.processdash.util.EnumerIterator in project processdash by dtuma.
the class RolledUpTimeLog method filter.
public EnumerIterator filter(String path, Date from, Date to) throws IOException {
List entries = new ArrayList();
String[] prefixes = getPrefixes();
StringMapper pathRemapper = getPathRemapper(prefixes);
for (int i = 0; i < prefixes.length; i++) {
String onePrefix = prefixes[i];
// find any imported entries for the given prefix
Iterator importedEntries = ImportedTimeLogManager.getInstance().getImportedTimeLogEntries(onePrefix);
maybeAddEntries(entries, importedEntries, pathRemapper);
// find any regular entries for the given prefix
Iterator regularEntries = context.getTimeLog().filter(onePrefix, from, to);
maybeAddEntries(entries, regularEntries, pathRemapper);
}
EnumerIterator result = new IteratorConcatenator(entries);
result = new TimeLogIteratorFilter(result, path, from, to);
return result;
}
Aggregations