use of net.sourceforge.processdash.hier.PropertyKey in project processdash by dtuma.
the class MoveProjectWizard method checkProject.
/**
* Checks to ensure that the prefix points to a team or master project.
* If so, sets the projectType and processID fields accordingly.
* If not, throws a {@link MoveProjectException}.
* @throws MoveProjectException
*/
private void checkProject() throws MoveProjectException {
DashHierarchy hierarchy = getPSPProperties();
PropertyKey key = hierarchy.findExistingKey(getPrefix());
String templateID = hierarchy.getID(key);
if (templateIs(templateID, MASTER_ROOT)) {
this.isMaster = true;
putValue(TEAM_MASTER_FLAG, "t");
putValue(TEAM_NAME, "Master");
putValue(TEAM_NAME_LOWER, "master");
} else if (templateIs(templateID, TEAM_ROOT)) {
this.isMaster = false;
putValue(TEAM_MASTER_FLAG, (SimpleData) null);
putValue(TEAM_NAME, "Team");
putValue(TEAM_NAME_LOWER, "team");
} else {
putValue(TEAM_NAME, "");
putValue(TEAM_NAME_LOWER, "");
throw new MoveProjectException("notTeamProject");
}
projectID = getStringValue(TeamDataConstants.PROJECT_ID);
if (!hasValue(projectID))
throw new MoveProjectException("noProjectID");
}
use of net.sourceforge.processdash.hier.PropertyKey in project processdash by dtuma.
the class MigrationToolTeam method convertHierarchy.
private void convertHierarchy() throws HierarchyAlterationException {
ProcessDashboard dash = (ProcessDashboard) ctx;
HierarchyAlterer alt = new HierarchyAlterer(dash);
DashHierarchy hier = ctx.getHierarchy();
PropertyKey key = hier.findExistingKey(projectPath);
// delete the children of the team project root node.
for (int i = hier.getNumChildren(key); i-- > 0; ) {
PropertyKey child = hier.getChildKey(key, i);
alt.deleteNode(child.path());
}
// change the template ID of the root node.
alt.setTemplateId(projectPath, newRootTemplateID);
}
use of net.sourceforge.processdash.hier.PropertyKey in project processdash by dtuma.
the class HierarchySynchronizer method findHierarchyNodesByID.
private void findHierarchyNodesByID(PropertyKey node, String id, List<PropertyKey> results) {
if (node == null)
return;
String nodeID = getWbsIdForPath(node.path());
if (id.equals(nodeID))
results.add(node);
for (int i = hierarchy.getNumChildren(node); i-- > 0; ) {
PropertyKey child = hierarchy.getChildKey(node, i);
findHierarchyNodesByID(child, id, results);
}
}
use of net.sourceforge.processdash.hier.PropertyKey in project processdash by dtuma.
the class MockActiveTaskModel method setNode.
public boolean setNode(PropertyKey node) {
if (node != null && hierarchy.containsKey(node)) {
PropertyKey oldNode = this.node;
this.node = node;
propSupport.firePropertyChange("node", oldNode, node);
return true;
} else {
return false;
}
}
use of net.sourceforge.processdash.hier.PropertyKey in project processdash by dtuma.
the class DashController method alterTemplateID.
public static boolean alterTemplateID(String prefix, String oldID, String newID) {
if (Settings.isReadOnly())
return false;
PropertyKey key = dash.props.findExistingKey(prefix);
String actualID = dash.props.getID(key);
if (// handles "null == null" case
oldID == actualID || (oldID != null && oldID.equals(actualID)))
try {
HierarchyAlterer a = new HierarchyAlterer(dash);
a.addTemplate(prefix, newID);
return true;
} catch (Exception e) {
}
return false;
}
Aggregations