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