use of net.sourceforge.processdash.hier.Prop in project processdash by dtuma.
the class HierarchyEditor method canPaste.
private boolean canPaste(String parentID, String parentPath, Vector templateChildren, DefaultMutableTreeNode cutNode) {
if (parentID == null || parentPath == null || cutNode == null || (templateChildren != null && templateChildren.size() == 0))
return false;
PropertyKey cutKey = treeModel.getPropKey(useProps, cutNode.getPath());
String cutPath = cutKey.path();
// disallow pasting a node into itself.
if (cutPath.equals(parentPath) || // create an illegal recursive tree.
parentPath.startsWith(cutPath + "/") || // already lives there!)
parentPath.equals(cutKey.getParent().path()))
return false;
Prop cutProp = useProps.pget(cutKey);
String cutID = cutProp.getID();
/* match child with parent's allowed child list, if any */
if (templateChildren != null && !templateChildren.contains(cutID))
return false;
/* match parent with child's required parent list, if any */
String cutStatus = cutProp.getStatus();
if (cutStatus == null)
return true;
/* no required parent */
int idx = cutStatus.indexOf(REQUIRED_PARENT);
if (idx == -1)
return true;
/* no required parent */
StringTokenizer st = new StringTokenizer(cutStatus.substring(idx + 1), String.valueOf(REQUIRED_PARENT));
while (st.hasMoreElements()) /* matches required parent */
if (parentID.equals(st.nextElement()))
return true;
// moved under arbitrary plain nodes
if ((cutID.endsWith("/IndivRoot") || cutID.endsWith("/Indiv2Root")) && "".equals(parentID))
return true;
return false;
}
use of net.sourceforge.processdash.hier.Prop in project processdash by dtuma.
the class TeamProjectBrowser method pruneForDisplay.
/**
* Recursively prune items so the leaves of the tree are all team project
* roots.
*
* @param hier
* the hierarchy to prune
* @param node
* one node to examine
* @return true if this node should be pruned from the tree, false otherwise
*/
private boolean pruneForDisplay(DashHierarchy hier, PropertyKey node) {
Prop p = hier.pget(node);
String templateId = p.getID();
boolean isProject = StringUtils.hasValue(templateId);
if (isProject && filter != null && !filter.shouldShow(node.path())) {
return true;
}
for (int i = p.getNumChildren(); i-- > 0; ) {
PropertyKey child = p.getChild(i);
boolean shouldPrune = isProject || pruneForDisplay(hier, child);
if (shouldPrune)
p.removeChild(i);
}
return isProject == false && p.getNumChildren() == 0;
}
use of net.sourceforge.processdash.hier.Prop in project processdash by dtuma.
the class TeamProjectBrowser method getOrCreateProp.
private Prop getOrCreateProp(DashHierarchy hier, PropertyKey key) {
Prop prop = hier.pget(key);
hier.put(key, prop);
return prop;
}
use of net.sourceforge.processdash.hier.Prop in project processdash by dtuma.
the class RepairDefectCounts method run.
private static void run(DashboardContext ctx, PropertyKey pKey, String dataDirectory) {
Prop prop = ctx.getHierarchy().pget(pKey);
String path = pKey.path();
String defLogName = prop.getDefectLog();
// If this node has a defect log,
if (defLogName != null && defLogName.length() != 0) {
DefectLog dl = new DefectLog(dataDirectory + defLogName, path, ctx.getData());
// read all the defects in that log, and
Defect[] defects = dl.readDefects();
// recalculate the associated data.
dl.recalculateData(defects, ctx);
}
// recursively analyze all the children of this node.
for (int i = 0; i < prop.getNumChildren(); i++) run(ctx, prop.getChild(i), dataDirectory);
}
use of net.sourceforge.processdash.hier.Prop in project processdash by dtuma.
the class ImportedDefectManager method buildWbsIdMap.
private static void buildWbsIdMap(Map result, DashHierarchy props, PropertyKey pKey, DataRepository data) {
Prop prop = props.pget(pKey);
String path = pKey.path();
// Get the WBS ID of this node in the hierarchy.
String wbsId = getWbsId(data, path);
if (!result.containsKey(wbsId))
result.put(wbsId, path);
// Check to see if this node supplies subcomponent info
Map componentInfo = getWbsSubcomponentInfo(data, path, wbsId);
if (componentInfo != null)
result.putAll(componentInfo);
// recursively scan all the children of this node.
for (int i = 0; i < prop.getNumChildren(); i++) buildWbsIdMap(result, props, prop.getChild(i), data);
}
Aggregations