Search in sources :

Example 6 with TimeLogEntry

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

the class TimeLogEditor method getTimes.

private SortedMap getTimes(Date fd, Date td) {
    SortedMap result = new TreeMap();
    try {
        for (Iterator i = timeLog.filter(null, fd, td); i.hasNext(); ) {
            TimeLogEntry tle = (TimeLogEntry) i.next();
            String path = tle.getPath();
            long[] t = (long[]) result.get(path);
            if (t == null) {
                t = new long[] { 0L };
                result.put(path, t);
            }
            t[0] += tle.getElapsedTime();
        }
    } catch (Exception e) {
    }
    return result;
}
Also used : SortedMap(java.util.SortedMap) TimeLogEntry(net.sourceforge.processdash.log.time.TimeLogEntry) ChangeFlaggedTimeLogEntry(net.sourceforge.processdash.log.time.ChangeFlaggedTimeLogEntry) EnumerIterator(net.sourceforge.processdash.util.EnumerIterator) Iterator(java.util.Iterator) TreeMap(java.util.TreeMap) IOException(java.io.IOException)

Example 7 with TimeLogEntry

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

the class TimeLogPhaseWaterfallChart method addTimeLogEntries.

private void addTimeLogEntries(ProcessUtil process, Map<String, PhaseSeries> phases, List timeLogEntries, GapSkipTracker gaps, ExceptionSeries exceptions) {
    for (Iterator i = timeLogEntries.iterator(); i.hasNext(); ) {
        TimeLogEntry tle = (TimeLogEntry) i.next();
        addTimeLogEntry(process, phases, tle, gaps, exceptions);
    }
}
Also used : TimeLogEntry(net.sourceforge.processdash.log.time.TimeLogEntry) Iterator(java.util.Iterator)

Example 8 with TimeLogEntry

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

the class TimeLogReport method writeHtml.

/** Write time log data in HTML format */
private void writeHtml(List l) throws IOException {
    super.writeHeader();
    String path = getPrefix();
    String title = For(path);
    String owner = For(getOwner());
    String header = HEADER_TEXT;
    header = resources.interpolate(header, HTMLUtils.ESC_ENTITIES);
    header = StringUtils.findAndReplace(header, "%for owner%", owner);
    header = StringUtils.findAndReplace(header, "%for path%", title);
    header = StringUtils.findAndReplace(header, "%css%", cssLinkHTML());
    out.print(header);
    if (noPermission) {
        interpOut(BLOCKED_BY_PERMISSION);
        out.print("</body></html>");
        return;
    }
    interpOut(START_TEXT);
    boolean showComments = !parameters.containsKey("hideComments");
    if (showComments)
        interpOut(COMMENT_HEADER);
    out.println("</tr>");
    String type = getParameter("type");
    ProcessUtil procUtil = null;
    if (!"rollup".equals(type) && !"db".equals(type))
        procUtil = new ProcessUtil(getDataContext());
    for (Iterator rows = l.iterator(); rows.hasNext(); ) {
        TimeLogEntry tle = (TimeLogEntry) rows.next();
        String entryPath = tle.getPath();
        String phase = (procUtil == null ? null : procUtil.getEffectivePhase(entryPath, false));
        if (phase == null) {
            int slashPos = entryPath.lastIndexOf('/');
            phase = entryPath.substring(slashPos + 1);
            entryPath = entryPath.substring(0, slashPos);
        }
        out.println("<TR>");
        out.println("<TD>" + HTMLUtils.escapeEntities(entryPath) + "</TD>");
        out.println("<TD>" + HTMLUtils.escapeEntities(phase) + "</TD>");
        out.println("<TD>" + (tle.getStartTime() == null ? "" : FormatUtil.formatDateTime(tle.getStartTime())) + "</TD>");
        out.println("<TD>" + tle.getElapsedTime() + "</TD>");
        out.println("<TD>" + tle.getInterruptTime() + "</TD>");
        if (showComments) {
            String comment = tle.getComment();
            out.println("<TD>" + (comment == null ? "" : HTMLUtils.escapeEntities(comment)) + "</TD>");
        }
        out.println("</TR>");
    }
    out.println("</TABLE>");
    if (!isExporting() && someEntriesBlocked)
        interpOut(FILTERED_BY_PERMISSION);
    out.println("<!-- cutEnd -->");
    if (parameters.get("skipFooter") == null) {
        if (!isExportingToExcel())
            out.print(resources.interpolate(EXPORT_LINK, HTMLUtils.ESC_ENTITIES));
        if (!isExporting() && !"rollup".equals(type) && !"db".equals(type) && !parameters.containsKey("noDisclaimer")) {
            StringBuffer html = new StringBuffer(resources.interpolate(DISCLAIMER, HTMLUtils.ESC_ENTITIES));
            StringUtils.findAndReplace(html, "&lt;a&gt;", "<a href='../control/showTimeLog'>");
            StringUtils.findAndReplace(html, "&lt;/a&gt;", "</a>");
            out.print(html.toString());
        }
    }
    out.println("</BODY></HTML>");
}
Also used : TimeLogEntry(net.sourceforge.processdash.log.time.TimeLogEntry) Iterator(java.util.Iterator) ProcessUtil(net.sourceforge.processdash.process.ProcessUtil)

Example 9 with TimeLogEntry

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

the class EVCalculatorData method saveActualPreTime.

private void saveActualPreTime(TimeLog log) throws IOException {
    try {
        Iterator entries = log.filter(null, null, scheduleStartDate);
        while (entries.hasNext()) {
            TimeLogEntry entry = (TimeLogEntry) entries.next();
            Date d = entry.getStartTime();
            if (d == null || d.compareTo(scheduleStartDate) >= 0)
                continue;
            EVTask task = taskRoot.getTaskForPath(entry.getPath());
            if (task != null && !task.isLevelOfEffortTask())
                task.actualPreTime += entry.getElapsedTime();
        }
    } catch (IONoSuchElementException ion) {
        throw ion.getIOException();
    }
}
Also used : IONoSuchElementException(net.sourceforge.processdash.log.time.IONoSuchElementException) TimeLogEntry(net.sourceforge.processdash.log.time.TimeLogEntry) Iterator(java.util.Iterator) Date(java.util.Date)

Aggregations

TimeLogEntry (net.sourceforge.processdash.log.time.TimeLogEntry)9 Iterator (java.util.Iterator)7 Date (java.util.Date)4 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 IONoSuchElementException (net.sourceforge.processdash.log.time.IONoSuchElementException)2 ProcessUtil (net.sourceforge.processdash.process.ProcessUtil)2 EnumerIterator (net.sourceforge.processdash.util.EnumerIterator)2 BufferedWriter (java.io.BufferedWriter)1 PrintWriter (java.io.PrintWriter)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Set (java.util.Set)1 SortedMap (java.util.SortedMap)1 TreeMap (java.util.TreeMap)1 PDashQuery (net.sourceforge.processdash.api.PDashQuery)1 EVTaskList (net.sourceforge.processdash.ev.EVTaskList)1 ChangeFlaggedTimeLogEntry (net.sourceforge.processdash.log.time.ChangeFlaggedTimeLogEntry)1 ModifiableTimeLog (net.sourceforge.processdash.log.time.ModifiableTimeLog)1 TimeLog (net.sourceforge.processdash.log.time.TimeLog)1