Search in sources :

Example 11 with Prop

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

the class TeamProjectSetupWizard method copyNodeIDsToHierarchy.

private static boolean copyNodeIDsToHierarchy(DataContext data, DashHierarchy hier, PropertyKey key) {
    boolean madeChange = false;
    SimpleData projectID = data.getSimpleValue(DataRepository.createDataName(key.path(), TeamDataConstants.PROJECT_ID));
    if (projectID != null && projectID.test()) {
        String nodeID = projectID.format() + ":root";
        Prop p = hier.pget(key);
        if (!nodeID.equals(p.getNodeID())) {
            p.setNodeID(nodeID);
            madeChange = true;
        }
    } else {
        for (int i = hier.getNumChildren(key); i-- > 0; ) {
            PropertyKey child = hier.getChildKey(key, i);
            if (copyNodeIDsToHierarchy(data, hier, child))
                madeChange = true;
        }
    }
    return madeChange;
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) SimpleData(net.sourceforge.processdash.data.SimpleData) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 12 with Prop

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

the class MigrationToolIndivLauncher method assertNoRootDefects.

private void assertNoRootDefects() {
    Prop p = ctx.getHierarchy().pget(projectRoot);
    String defectLogFilename = p.getDefectLog();
    if (!StringUtils.hasValue(defectLogFilename))
        return;
    File defectLogFile = new File(targetDir, defectLogFilename);
    if (defectLogFile.length() == 0)
        return;
    String message = getRes("Error.Root_Defects_FMT", esc(projectPath));
    failedPreconditions.add(message);
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) File(java.io.File)

Example 13 with Prop

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

the class MigrationToolIndivLauncher method getPhaseChildren.

private List<String> getPhaseChildren(PropertyKey node) {
    List<String> result = new ArrayList<String>();
    Prop p = ctx.getHierarchy().pget(node);
    for (int i = 0; i < p.getNumChildren(); i++) {
        PropertyKey childKey = p.getChild(i);
        Prop child = ctx.getHierarchy().pget(childKey);
        String templateID = child.getID();
        if (templateID != null && templateID.contains("/PHASE/"))
            result.add(childKey.name());
    }
    return result;
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) ArrayList(java.util.ArrayList) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 14 with Prop

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

the class TemplateLoader method createProcessRoot.

/**
     * The templates hierarchy needs a root.  However, that root cannot
     * be read from any file because its children are determined dynamically
     * by searching classpaths and template directories.  Once the children
     * are loaded from their various locations, this routine dynamically
     * builds their parent.
     *
     * NOTE: currently, the children are placed in alphabetical order.
     */
private static void createProcessRoot(DashHierarchy templates) {
    Enumeration nodes = templates.keys();
    Vector processes = new Vector();
    PropertyKey key, parent;
    while (nodes.hasMoreElements()) {
        key = (PropertyKey) nodes.nextElement();
        parent = key.getParent();
        if (parent != null && parent.equals(PropertyKey.ROOT))
            processes.add(key);
    }
    if (processes.size() > 0) {
        Collections.sort(processes);
        Prop p = new Prop();
        while (processes.size() > 0) p.addChild((PropertyKey) processes.remove(0), -1);
        templates.put(PropertyKey.ROOT, p);
    }
}
Also used : Enumeration(java.util.Enumeration) Prop(net.sourceforge.processdash.hier.Prop) Vector(java.util.Vector) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 15 with Prop

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

the class TemplateInfo method addSafeNamesOfProcessPhases.

public static final void addSafeNamesOfProcessPhases(HierarchyNodeMapper m) {
    if (TEMPLATES == null)
        // about the phases in various metrics collection frameworks.
        return;
    for (Iterator i = TEMPLATES.entrySet().iterator(); i.hasNext(); ) {
        Map.Entry e = (Map.Entry) i.next();
        PropertyKey key = (PropertyKey) e.getKey();
        Prop prop = (Prop) e.getValue();
        if (PROCESS_PHASE_STATUS.equals(prop.getStatus())) {
            String phaseName = Prop.unqualifiedName(key.name());
            m.addSafeName(phaseName);
        }
    }
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) Iterator(java.util.Iterator) Map(java.util.Map) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Aggregations

Prop (net.sourceforge.processdash.hier.Prop)30 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)16 Iterator (java.util.Iterator)4 StringTokenizer (java.util.StringTokenizer)4 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)4 Map (java.util.Map)3 Vector (java.util.Vector)3 Enumeration (java.util.Enumeration)2 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Hashtable (java.util.Hashtable)1 TreeMap (java.util.TreeMap)1 JMenu (javax.swing.JMenu)1 JMenuItem (javax.swing.JMenuItem)1 MutableTreeNode (javax.swing.tree.MutableTreeNode)1 TreeNode (javax.swing.tree.TreeNode)1 TreePath (javax.swing.tree.TreePath)1