Search in sources :

Example 6 with DashHierarchy

use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.

the class EditSubprojectList method ensureMasterProject.

private void ensureMasterProject() throws TinyCGIException {
    DashHierarchy hierarchy = getPSPProperties();
    PropertyKey key = hierarchy.findExistingKey(getPrefix());
    String templateID = hierarchy.getID(key);
    if (templateID == null || !templateID.endsWith(MASTER_ROOT))
        throw new TinyCGIException(403, "Not a Master Project");
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) PropertyKey(net.sourceforge.processdash.hier.PropertyKey) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Example 7 with DashHierarchy

use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.

the class TeamProjectBrowser method getHierarchyToDisplay.

private DashHierarchy getHierarchyToDisplay() {
    DashHierarchy result = new DashHierarchy("");
    result.copy(ctx.getHierarchy());
    pruneForDisplay(result, PropertyKey.ROOT);
    maybeCreateDefaultHierarchy(result);
    return result;
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy)

Example 8 with DashHierarchy

use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.

the class Hierleaves method call.

/** Perform a procedure call.
     *
     * This method <b>must</b> be thread-safe.
     */
public Object call(List arguments, ExpressionContext context) {
    String prefix;
    if (!arguments.isEmpty())
        prefix = asStringVal(getArg(arguments, 0));
    else
        prefix = context.get(ExpressionContext.PREFIXVAR_NAME).format();
    if (prefix == null)
        return null;
    try {
        ListData hierItem = (ListData) context.get(DashHierarchy.DATA_REPOSITORY_NAME);
        DashHierarchy hier = (DashHierarchy) hierItem.get(0);
        PropertyKey key = hier.findExistingKey(prefix);
        if (key == null)
            return null;
        ListData result = new ListData();
        collect(result, hier, key);
        return result;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) PropertyKey(net.sourceforge.processdash.hier.PropertyKey) ListData(net.sourceforge.processdash.data.ListData)

Example 9 with DashHierarchy

use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.

the class SizeInventoryForm method writeContents.

public void writeContents() throws IOException {
    String prefix = getPrefix();
    if (prefix == null)
        prefix = "/";
    DashHierarchy hierarchy = getPSPProperties();
    PropertyKey key = hierarchy.findExistingKey(prefix);
    String uri = getURI();
    highlightTimestamp = getHighlightTimestamp();
    out.println(HTML_HEADER);
    out.println("<h2>");
    out.print(HTMLUtils.escapeEntities(prefix));
    out.println("</h2><form name='sizes'>");
    out.flush();
    if (!prefix.endsWith("/"))
        prefix = prefix + "/";
    expansionText = new StringBuffer();
    writeHierarchy(uri, prefix, key, hierarchy);
    if (highlightTimestamp > 0 && expansionText.length() == 0) {
        // if we were asked to highlight, but no matching sections were
        // found, clear the highlight request and draw all sections.
        highlightTimestamp = -1;
        writeHierarchy(uri, prefix, key, hierarchy);
    }
    if (highlightTimestamp <= 0)
        writeHierarchyExpanders(expansionText);
    expansionText = null;
    out.println("</form><script src='/data.js'>" + "document.writeln('<p>Problem loading the script!');" + "</script>");
    out.println("</body></html>");
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 10 with DashHierarchy

use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.

the class GenericPlanSummaryForm method writeContents.

protected void writeContents() throws IOException {
    StringBuffer uri = new StringBuffer((String) env.get("SCRIPT_PATH"));
    uri.setLength(uri.length() - 6);
    uri.append(".shtm");
    String unit, units;
    DataRepository data = getDataRepository();
    String prefix = getPrefix();
    SimpleData d = data.getSimpleValue(prefix + "/" + UNITS_NAME);
    units = (d != null ? d.format() : null);
    if (units == null || units.trim().length() == 0)
        units = resources.getString("Default_Units");
    int semicolonPos = units.indexOf(';');
    if (semicolonPos > -1) {
        unit = units.substring(0, semicolonPos);
        units = units.substring(semicolonPos + 1);
    } else if (units.endsWith("s")) {
        unit = units.substring(0, units.length() - 1);
    } else {
        unit = units;
    }
    HTMLUtils.appendQuery(uri, "Unit", unit);
    HTMLUtils.appendQuery(uri, "Units", units);
    DashHierarchy props = getPSPProperties();
    PropertyKey self = props.findExistingKey(getPrefix());
    int numPhases = props.getNumChildren(self);
    for (int i = 0; i < numPhases; i++) HTMLUtils.appendQuery(uri, "Phases", props.getChildKey(self, i).name());
    String text = getRequestAsString(uri.toString());
    out.write(text);
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) DataRepository(net.sourceforge.processdash.data.repository.DataRepository) SimpleData(net.sourceforge.processdash.data.SimpleData) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Aggregations

DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)56 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)40 ArrayList (java.util.ArrayList)7 ListData (net.sourceforge.processdash.data.ListData)6 List (java.util.List)5 HashMap (java.util.HashMap)4 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)4 Point (java.awt.Point)3 Iterator (java.util.Iterator)3 ProcessDashboard (net.sourceforge.processdash.ProcessDashboard)3 SimpleData (net.sourceforge.processdash.data.SimpleData)3 TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)3 IOException (java.io.IOException)2 Enumeration (java.util.Enumeration)2 HashSet (java.util.HashSet)2 LinkedList (java.util.LinkedList)2 HierarchyAlterer (net.sourceforge.processdash.hier.HierarchyAlterer)2 Prop (net.sourceforge.processdash.hier.Prop)2 DefectLog (net.sourceforge.processdash.log.defects.DefectLog)2 DefectLogID (net.sourceforge.processdash.log.defects.DefectLogID)2