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");
}
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;
}
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;
}
}
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>");
}
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);
}
Aggregations