use of net.sourceforge.processdash.hier.DashHierarchy 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.DashHierarchy 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.DashHierarchy in project processdash by dtuma.
the class DefaultTimeLoggingModelTest method setUp.
protected void setUp() throws Exception {
super.setUp();
eventsReceived = new LinkedList();
expectedTimes = new HashMap();
data = new MockDataContext();
hier = new DashHierarchy(null);
hier.loadXML(openFile("hier3.xml"), new DashHierarchy(null));
createModels();
activeTaskModel = new MockActiveTaskModel(hier);
timeLoggingModel.setActiveTaskModel(activeTaskModel);
timeLog.addTimeLogListener(this);
timeLoggingModel.addPropertyChangeListener(this);
}
use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.
the class SelectWBSNode method getStartingKey.
// start at the root of the current project.
protected PropertyKey getStartingKey() {
DashHierarchy hierarchy = getPSPProperties();
PropertyKey key = hierarchy.findExistingKey(getPrefix());
while (key != null) {
String id = getID(hierarchy, key);
if (id != null && id.endsWith("Root"))
break;
key = key.getParent();
}
return key;
}
use of net.sourceforge.processdash.hier.DashHierarchy in project processdash by dtuma.
the class GetUnassignedAndDeferredTime method isMaster.
private boolean isMaster(String projectPath) throws IOException {
DashHierarchy hierarchy = getPSPProperties();
PropertyKey key = hierarchy.findExistingKey(projectPath);
String templateID = null;
if (key != null)
templateID = hierarchy.getID(key);
if (templateID == null)
throw new TinyCGIException(404, "Not a team project");
else if (templateID.endsWith(SyncWBS.MASTER_ROOT))
return true;
else if (templateID.endsWith(SyncWBS.TEAM_ROOT))
return false;
else
throw new TinyCGIException(404, "Not a team project");
}
Aggregations