Search in sources :

Example 96 with PropertyKey

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

the class HierarchySynchronizer method getTotalActualTimeForIndivNode.

private double getTotalActualTimeForIndivNode(PropertyKey node) {
    double result = 0;
    // add time logged directly to the node, if it exists.
    SimpleData d = getData(node.path(), ACT_TIME_DATA_NAME);
    result += getDoubleData(d);
    // if the node has children, add their time too.
    for (int i = hierarchy.getNumChildren(node); i-- > 0; ) {
        PropertyKey child = hierarchy.getChildKey(node, i);
        result += getTotalActualTimeForIndivNode(child);
    }
    return result;
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 97 with PropertyKey

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

the class HierarchySynchronizer method processDeferredDeletions.

private void processDeferredDeletions(SyncWorker worker) throws HierarchyAlterationException {
    if (deferredDeletions != null && !worker.nodesWereRenamed()) {
        // sort the list, to ensure that parents appear in the list before
        // their children do
        Collections.sort(deferredDeletions);
        while (!deferredDeletions.isEmpty()) {
            // get the next item that needs deleting
            String nodeToDelete = (String) deferredDeletions.remove(0);
            // question, they are redundant.  Discard them.
            for (Iterator i = deferredDeletions.iterator(); i.hasNext(); ) {
                String path = (String) i.next();
                if (Filter.pathMatches(path, nodeToDelete, true))
                    i.remove();
            }
            // perform the deletion/completion.
            PropertyKey key = hierarchy.findExistingKey(nodeToDelete);
            completeOrDeleteNode(worker, key);
        }
    }
}
Also used : Iterator(java.util.Iterator) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 98 with PropertyKey

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

the class HierarchySynchronizer method assignClientIDsToChildrenOf.

private void assignClientIDsToChildrenOf(PropertyKey parent) {
    for (int i = hierarchy.getNumChildren(parent); i-- > 0; ) {
        PropertyKey node = hierarchy.getChildKey(parent, i);
        String path = node.path();
        // see if this node has a WBS ID, or if it is user-created.
        String wbsID = getWbsIdForPath(path);
        if (wbsID == null) {
            // This is a user-created node. See if it has a client ID.
            String clientID = getClientIdForPath(path);
            if (clientID == null) {
                // this user-created node does not have a client ID yet.
                // assign a new, unique client ID to this node.
                String newClientID = getNextClientId();
                forceData(path, TeamDataConstants.CLIENT_ID_DATA_NAME, StringData.create(newClientID));
            } else {
                // this user-created node was assigned a client ID in the
                // past. Check the WBS to see if the node has been assigned
                // a real ID yet. If so, store it and discard the client ID.
                String newWbsID = clientIdMap.get(clientID);
                if (XMLUtils.hasValue(newWbsID)) {
                    forceData(path, TeamDataConstants.WBS_ID_DATA_NAME, StringData.create(newWbsID));
                    forceData(path, TeamDataConstants.CLIENT_ID_DATA_NAME, null);
                } else {
                    try {
                        // if this user-created node was added to the WBS in
                        // the past, but has already been deleted, give it a
                        // bogus WBS ID to flag it for deletion.
                        int pos = clientID.lastIndexOf(':') + 1;
                        int num = Integer.parseInt(clientID.substring(pos));
                        if (num <= maxHandledClientIdNum)
                            forceData(path, TeamDataConstants.WBS_ID_DATA_NAME, StringData.create("-" + num));
                    } catch (Exception e) {
                    }
                }
            }
        }
        // recurse over children
        if (!isPSPTask(node))
            assignClientIDsToChildrenOf(node);
    }
}
Also used : PropertyKey(net.sourceforge.processdash.hier.PropertyKey) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException) HierarchyAlterationException(net.sourceforge.processdash.hier.HierarchyAlterer.HierarchyAlterationException) IOException(java.io.IOException)

Example 99 with PropertyKey

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

the class UserDataWriter method writeNewTasks.

private void writeNewTasks(XmlSerializer ser, String processID) throws IOException {
    DashHierarchy hier = getPSPProperties();
    PropertyKey projectRoot = hier.findExistingKey(getPrefix());
    String phaseDataName = HierarchySynchronizer.getEffectivePhaseDataName(processID);
    writeNewTasks(ser, hier, projectRoot, "root", phaseDataName);
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 100 with PropertyKey

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

the class UserDataWriter method writeNewTasks.

private void writeNewTasks(XmlSerializer ser, DashHierarchy hier, PropertyKey parent, String parentID, String phaseDataName) throws IOException {
    String prevSiblingID = null;
    for (int i = 0; i < hier.getNumChildren(parent); i++) {
        PropertyKey child = hier.getChildKey(parent, i);
        String path = child.path();
        String childID = getWbsIdForPath(path);
        if (!hasValue(childID)) {
            // this task does not have a WBS ID, so it is new.  Write a
            // "new task" entry for it.
            childID = getClientIdForPath(path);
            if (hasValue(childID))
                writeNewTaskTag(ser, hier, parentID, prevSiblingID, child, childID, phaseDataName);
            else
                continue;
        }
        // Recurse and look for new tasks underneath this task.
        if (!isPSPTask(path))
            writeNewTasks(ser, hier, child, childID, phaseDataName);
        prevSiblingID = childID;
    }
}
Also used : PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Aggregations

PropertyKey (net.sourceforge.processdash.hier.PropertyKey)125 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)40 Prop (net.sourceforge.processdash.hier.Prop)16 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)10 SimpleData (net.sourceforge.processdash.data.SimpleData)7 ArrayList (java.util.ArrayList)6 Enumeration (java.util.Enumeration)6 IOException (java.io.IOException)5 Iterator (java.util.Iterator)5 StringTokenizer (java.util.StringTokenizer)5 TreePath (javax.swing.tree.TreePath)5 ListData (net.sourceforge.processdash.data.ListData)5 DefectLog (net.sourceforge.processdash.log.defects.DefectLog)5 List (java.util.List)4 ProcessDashboard (net.sourceforge.processdash.ProcessDashboard)4 HierarchyAlterer (net.sourceforge.processdash.hier.HierarchyAlterer)4 HierarchyAlterationException (net.sourceforge.processdash.hier.HierarchyAlterer.HierarchyAlterationException)4 DefectLogID (net.sourceforge.processdash.log.defects.DefectLogID)4 TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)4 Point (java.awt.Point)3