Search in sources :

Example 11 with TinyCGIException

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

the class ScanItemListBulkHandler method writeContents.

@Override
protected void writeContents() throws IOException {
    parseFormData();
    String[] itemIDs = (String[]) parameters.get("id_ALL");
    boolean checked = "true".equals(parameters.get("checked"));
    DateData valueToStore = checked ? new DateData() : null;
    DataContext data = getDataContext();
    for (String itemID : itemIDs) {
        if (!checkValidID(itemID))
            throw new TinyCGIException(400, "Bad item ID");
        data.putValue(itemID, valueToStore);
    }
    out.write("OK");
}
Also used : DataContext(net.sourceforge.processdash.data.DataContext) DateData(net.sourceforge.processdash.data.DateData) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Example 12 with TinyCGIException

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

the class GetUnassignedAndDeferredTime method isMaster.

private boolean isMaster(String projectPath) throws IOException {
    DashHierarchy hierarchy = getPSPProperties();
    PropertyKey key = hierarchy.findExistingKey(projectPath);
    String templateID = null;
    if (key != null)
        templateID = hierarchy.getID(key);
    if (templateID == null)
        throw new TinyCGIException(404, "Not a team project");
    else if (templateID.endsWith(SyncWBS.MASTER_ROOT))
        return true;
    else if (templateID.endsWith(SyncWBS.TEAM_ROOT))
        return false;
    else
        throw new TinyCGIException(404, "Not a team project");
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) PropertyKey(net.sourceforge.processdash.hier.PropertyKey) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Example 13 with TinyCGIException

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

the class SavePageHandler method service.

public String service(Writer out, String pageName) throws IOException {
    if (Settings.isReadOnly()) {
        out.write("Location: /dash/snippets/saveError.shtm?err=Read_Only" + "\r\n\r\n");
        return null;
    } else if (!AbstractPageAssembler.hasEditPermission()) {
        throw new TinyCGIException(403, "No permission");
    }
    // read the description of the page from posted form data
    PageContentTO page = parsePostedPageContent();
    // get an output stream for saving the contents
    String persistenceQualifier = page.getMetadataValue(PersistenceService.QUALIFIER_ATTRIBUTE_NAME, null);
    OutputStream dest = CmsDefaultConfig.getPersistence().save(persistenceQualifier, pageName);
    // serialize the contents to the output stream
    ContentSerializer ser = CmsDefaultConfig.getSerializer();
    ser.format(page, dest);
    dest.close();
    // ask the dispatcher to redirect to the plain viewing page.
    return "";
}
Also used : OutputStream(java.io.OutputStream) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Example 14 with TinyCGIException

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

the class EditSinglePageAssembler method writePage.

@Override
protected void writePage(Writer out, Set headerItems, PageContentTO page) throws IOException {
    if (!hasEditPermission())
        throw new TinyCGIException(403, "No permission");
    out.write(HTML_TRANSITIONAL_DOCTYPE);
    out.write("<html>\n");
    writeHead(out, headerItems, page);
    out.write("<body scroll=\"yes\">\n");
    writeFormStart(out);
    writeHeaderElements(out, page);
    writePageMetadataEditors(out, page);
    writePageSnippetEditors(out, page);
    writeFooterElements(out, page);
    writeFormEnd(out);
    out.write("<script type=\"text/javascript\">DashCMS.initPage();</script>\n");
    out.write("</body>\n");
    out.write("</html>\n");
}
Also used : TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Example 15 with TinyCGIException

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

the class LOCDiffReport method printStoredReport.

private void printStoredReport() throws IOException {
    long reportId = Long.parseLong(getParameter("report"));
    File reportFile = STORED_REPORTS.get(reportId);
    if (reportFile == null)
        throw new TinyCGIException(404, "Report Not Found");
    else
        FileUtils.copyFile(reportFile, outStream);
}
Also used : File(java.io.File) 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