Search in sources :

Example 16 with TinyCGIException

use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.

the class DisplayState method doGet.

@Override
protected void doGet() throws IOException {
    xml = null;
    String script = (String) env.get("SCRIPT_NAME");
    if (script.contains("getTimingState"))
        writeTimingState();
    else if (script.contains("getHierarchy"))
        writeHierarchy();
    else if (script.contains("getScripts"))
        writeScripts();
    else
        throw new TinyCGIException(404, "Unrecognized request");
}
Also used : TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Example 17 with TinyCGIException

use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.

the class JoinTeamProject method maybeReroot.

/** If the current prefix doesn't name the root of a team project,
     * search upward through the hierarchy to find the project root,
     * and change the active prefix to name that node. */
protected void maybeReroot() throws TinyCGIException {
    DashHierarchy hierarchy = getPSPProperties();
    PropertyKey key = hierarchy.findExistingKey(getPrefix());
    boolean rerooted = false;
    String projectRoot = null;
    do {
        String templateID = hierarchy.getID(key);
        if (templateID != null && templateID.endsWith("/TeamRoot")) {
            projectRoot = key.path();
            break;
        }
        rerooted = true;
        key = key.getParent();
    } while (key != null);
    if (rerooted) {
        if (projectRoot != null)
            parameters.put("hierarchyPath", projectRoot);
        else
            throw new TinyCGIException(404, "Not Fount");
    }
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) PropertyKey(net.sourceforge.processdash.hier.PropertyKey) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Example 18 with TinyCGIException

use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.

the class RepublishTeamSettings method writeContents.

@Override
protected void writeContents() throws IOException {
    // ensure we are running in a team dashboard
    if (!Settings.isTeamMode())
        throw new TinyCGIException(400, "Only supported for team dashboards");
    // perform the requested republish operation
    List<String> errors = TeamSettingsRepublisher.getInstance().republish(true);
    // write the results
    out.write("<html><head><title>Republish Team Settings</title></head>\n");
    out.write("<body><h1>Republish Team Settings</h1>\n");
    out.write("Team settings files republished at " + new Date());
    // if any errors were encountered, mention them
    if (!errors.isEmpty()) {
        out.write("<p>Settings for the following projects could " + "not be published:<ul>");
        for (String project : errors) out.write("<li>" + HTMLUtils.escapeEntities(project) + "</li>");
        out.write("</ul>The dashboard's <a href='showConsole.class'>debug " + "log</a> may have more information.</p>");
    }
    // end the document
    out.write("</body></html>\n");
}
Also used : Date(java.util.Date) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Example 19 with TinyCGIException

use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.

the class Wizard method getPage.

/** Get a page by its numbered position */
private WizardPage getPage(int pagePos) throws IOException {
    try {
        WizardPage result = (WizardPage) WIZARD_PAGES[pagePos].newInstance();
        result.setOut(out);
        result.setParams(parameters);
        result.setData(getDataRepository());
        result.setPrefix(getPrefix());
        if (pagePos > 0)
            result.setPrevPage(PAGE_KEYS[pagePos - 1]);
        result.setCurrPage(PAGE_KEYS[pagePos]);
        result.setNextPage(PAGE_KEYS[pagePos + 1]);
        result.setStepNumber(pagePos);
        result.settingDone();
        return result;
    } catch (Throwable t) {
        t.printStackTrace();
        TinyCGIException e = new TinyCGIException(500, "Internal Error");
        e.initCause(t);
        throw e;
    }
}
Also used : TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Example 20 with TinyCGIException

use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.

the class OpenDefectDialog method openExistingDefectDialog.

private void openExistingDefectDialog(DefectLogID defectLog, String id) throws TinyCGIException {
    DefectLog log = new DefectLog(defectLog.filename, defectLog.path.path(), getDataRepository());
    Defect defect = log.getDefect(id);
    if (defect == null)
        throw new TinyCGIException(404, "No defect found with ID '" + id + "' in " + defectLog.path.path());
    DefectDialog dlg = DefectDialog.getDialogForDefect(getDash(), defectLog.filename, defectLog.path, defect, true);
    dlg.setTitle(defectLog.path.path());
    dlg.toFront();
}
Also used : DefectLog(net.sourceforge.processdash.log.defects.DefectLog) Defect(net.sourceforge.processdash.log.defects.Defect) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Aggregations

TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)22 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 Date (java.util.Date)3 EVTaskList (net.sourceforge.processdash.ev.EVTaskList)3 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)3 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)3 Map (java.util.Map)2 DefaultTaskLabeler (net.sourceforge.processdash.ev.DefaultTaskLabeler)2 EVDependencyCalculator (net.sourceforge.processdash.ev.EVDependencyCalculator)2 EVTaskListGroupFilter (net.sourceforge.processdash.ev.EVTaskListGroupFilter)2 EVTaskListRollup (net.sourceforge.processdash.ev.EVTaskListRollup)2 UserFilter (net.sourceforge.processdash.team.group.UserFilter)2 BufferedInputStream (java.io.BufferedInputStream)1 File (java.io.File)1 OutputStream (java.io.OutputStream)1 HttpURLConnection (java.net.HttpURLConnection)1 MalformedURLException (java.net.MalformedURLException)1 URLConnection (java.net.URLConnection)1 ArrayList (java.util.ArrayList)1