Search in sources :

Example 6 with ProcessUtil

use of net.sourceforge.processdash.process.ProcessUtil in project processdash by dtuma.

the class TimeLogPhaseWaterfallChart method createChart.

@Override
public JFreeChart createChart() {
    ProcessUtil process = new ProcessUtil(getDataContext());
    List<String> phases = getPhaseList(process);
    List timeLogEntries = getTimeLogEntries();
    GapSkipTracker gaps = createGapTracker();
    IntervalXYDataset dataset = createDataset(process, phases, timeLogEntries, gaps);
    return createChart(dataset, process, phases, gaps);
}
Also used : IntervalXYDataset(org.jfree.data.xy.IntervalXYDataset) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) ProcessUtil(net.sourceforge.processdash.process.ProcessUtil)

Example 7 with ProcessUtil

use of net.sourceforge.processdash.process.ProcessUtil in project processdash by dtuma.

the class TimeLogProblemReport method writeContents.

@Override
protected void writeContents() throws IOException {
    out.println(HEADER);
    DataContext data = getDataContext();
    ProcessUtil process = new ProcessUtil(data);
    List phases = process.getProcessListPlain("Phase_List");
    phases = process.filterPhaseList(phases);
    List<String> missingPhases = new ArrayList<String>();
    for (Iterator i = phases.iterator(); i.hasNext(); ) {
        String phase = (String) i.next();
        if (getBoolParam("Check" + phase)) {
            SimpleData phaseTime = data.getSimpleValue(phase + "/Time");
            if (phaseTime == null || !phaseTime.test())
                missingPhases.add(phase);
        }
    }
    if (missingPhases.isEmpty()) {
        printStudentDataOK(res().getString("OK_Message"));
    } else {
        String missingPhaseStr = joinList(missingPhases, "or");
        String message = getParameter("Message");
        if (!StringUtils.hasValue(message))
            message = res().getString("Default_Error_Message");
        message = StringUtils.findAndReplace(message, "[PHASES]", missingPhaseStr);
        printStudentDataError(message);
    }
    out.println(FOOTER);
}
Also used : DataContext(net.sourceforge.processdash.data.DataContext) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) SimpleData(net.sourceforge.processdash.data.SimpleData) ProcessUtil(net.sourceforge.processdash.process.ProcessUtil)

Example 8 with ProcessUtil

use of net.sourceforge.processdash.process.ProcessUtil 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 ProcessUtil

use of net.sourceforge.processdash.process.ProcessUtil in project processdash by dtuma.

the class InputPage method writeVerifyInput.

private boolean writeVerifyInput(boolean full, boolean checkMismatch) {
    ProcessUtil processUtil = new ProcessUtil(data, prefix);
    String probeInputElem = processUtil.getProcessString(ProbeData.PROBE_INPUT_METRIC);
    String probeInputElemDisplay = Translator.translate(probeInputElem);
    String elemNameHTML = esc(probeInputElemDisplay);
    boolean editInputAllowed = full && "".equals(processUtil.getProcessString("PROBE_NO_EDIT_INPUT"));
    if (full)
        writeStepTitle(resources.format("Input.Verify_Title_FMT", probeInputElemDisplay));
    else
        writeSectionTitle(probeInputElemDisplay);
    double inputVal = getNumber(probeInputElem);
    double lastInputVal = getNumber(ProbeData.PROBE_LAST_RUN_PREFIX + probeInputElem);
    if (editInputAllowed) {
        if (Double.isNaN(inputVal))
            inputVal = 0;
        // write the prompt
        out.print(resources.format("Input.Provide_Input_HTML_FMT", elemNameHTML));
        // write a field for entry of the data
        out.print("<p>");
        out.print(elemNameHTML);
        out.print("<input type='text' name='" + INPUT_VAL + "' value='");
        out.print(FormatUtil.formatNumber(inputVal));
        out.print("'>&nbsp;");
        out.print(esc(processUtil.getSizeAbbrLabel()));
        out.print("</p>");
    } else if (checkMismatch == true && !Double.isNaN(lastInputVal) && (Math.abs(inputVal - lastInputVal) > 0.1)) {
        String inputValHTML = "<tt><b>" + FormatUtil.formatNumber(inputVal) + "</b></tt>";
        String lastInputValHTML = "<tt><b>" + FormatUtil.formatNumber(lastInputVal) + "</b></tt>";
        out.print("<div class=\"alertError\">");
        out.print(resources.format("Input.Input_Mismatch_Error_HTML_FMT", elemNameHTML, lastInputValHTML, inputValHTML));
        out.println("</div>");
    } else if (inputVal > 0) {
        String inputValHTML = "<tt><b>" + FormatUtil.formatNumber(inputVal) + "</b></tt>";
        out.print(full ? "<p>" : "<p style='margin-left:1cm'>");
        out.print(resources.format("Input.Verify_Input_HTML_FMT", elemNameHTML, inputValHTML));
        out.println("</p>");
        if (full) {
            out.print("<p>");
            out.print(resources.format("Input.Verify_Input_Instr_HTML_FMT", elemNameHTML, inputValHTML));
            out.println("</p>");
        }
    } else {
        out.print("<p>");
        if (!full)
            out.print("<font color='red'><b>");
        out.print(resources.format("Input.Input_Missing_Error_HTML_FMT", elemNameHTML));
        if (!full)
            out.print("</b></font>");
        out.println("</p>");
        if (full) {
            out.print("<p>");
            out.print(resources.format("Input.Input_Missing_Error_Instr_HTML_FMT", elemNameHTML));
            out.println("</p>");
        }
        return false;
    }
    return true;
}
Also used : ProcessUtil(net.sourceforge.processdash.process.ProcessUtil)

Example 10 with ProcessUtil

use of net.sourceforge.processdash.process.ProcessUtil in project processdash by dtuma.

the class DefectLogProblemReport method writeContents.

@Override
protected void writeContents() throws IOException {
    defectsWithNoFixTime = new ArrayList();
    defectsWithNoDescription = new ArrayList();
    failureDefectsWithNoFixNumber = new ArrayList();
    samePhaseDefects = new ArrayList();
    misorderedDefects = new ArrayList();
    ProcessUtil procUtil = new ProcessUtil(getDataContext());
    phaseList = procUtil.getProcessListPlain("Phase_List");
    phaseList.add(AFTER_DEVELOPMENT);
    failurePhaseList = procUtil.getProcessListPlain("Failure_Phase_List");
    failurePhaseList.add(AFTER_DEVELOPMENT);
    runDefectAnalysis();
    out.println(HEADER);
    boolean foundMissingData = false;
    if (!defectsWithNoFixTime.isEmpty()) {
        printStudentDataError("You did not capture the fix time for " + defects(defectsWithNoFixTime) + ".");
        foundMissingData = true;
    }
    if (!defectsWithNoDescription.isEmpty()) {
        printStudentDataError("You did not enter a description for " + defects(defectsWithNoDescription) + ".");
        foundMissingData = true;
    }
    if (!failureDefectsWithNoFixNumber.isEmpty()) {
        printStudentDataError("Were you fixing " + plural(failureDefectsWithNoFixNumber, "another defect", "other defects") + " when you injected " + defects(failureDefectsWithNoFixNumber) + "? If so, you should record the number of the " + "original defect in the 'Fix Defect' field.");
        foundMissingData = true;
    }
    if (!foundMissingData)
        printStudentDataOK("All required data was entered for each defect.");
    boolean foundOrderingProblem = false;
    if (!misorderedDefects.isEmpty()) {
        printStudentDataError("It is impossible to remove a defect before " + "you inject it. Please recheck the injection and " + "removal phases for " + defects(misorderedDefects) + ".");
        foundOrderingProblem = true;
    }
    if (!samePhaseDefects.isEmpty()) {
        printStudentDataError("PSP does not require you to record defects " + "that were found and removed all in the same phase " + "(such as " + defects(samePhaseDefects) + ").");
        foundOrderingProblem = true;
    }
    if (!foundOrderingProblem)
        printStudentDataOK("All defects were injected before they were removed.");
    out.print(FOOTER);
}
Also used : ArrayList(java.util.ArrayList) ProcessUtil(net.sourceforge.processdash.process.ProcessUtil)

Aggregations

ProcessUtil (net.sourceforge.processdash.process.ProcessUtil)12 ArrayList (java.util.ArrayList)8 List (java.util.List)5 Iterator (java.util.Iterator)3 SimpleData (net.sourceforge.processdash.data.SimpleData)3 DataContext (net.sourceforge.processdash.data.DataContext)2 TimeLogEntry (net.sourceforge.processdash.log.time.TimeLogEntry)2 Color (java.awt.Color)1 Paint (java.awt.Paint)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 Date (java.util.Date)1 Enumeration (java.util.Enumeration)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 PDashQuery (net.sourceforge.processdash.api.PDashQuery)1 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)1 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)1 AddTaskTypeOption (net.sourceforge.processdash.hier.ui.AddTaskTypeOption)1 SizePerItemTable (net.sourceforge.processdash.tool.probe.SizePerItemTable)1