Search in sources :

Example 21 with DashHierarchy

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");
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) SimpleData(net.sourceforge.processdash.data.SimpleData) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 22 with DashHierarchy

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);
}
Also used : HierarchyAlterer(net.sourceforge.processdash.hier.HierarchyAlterer) DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) ProcessDashboard(net.sourceforge.processdash.ProcessDashboard) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 23 with DashHierarchy

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);
}
Also used : HashMap(java.util.HashMap) DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) LinkedList(java.util.LinkedList)

Example 24 with DashHierarchy

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;
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 25 with DashHierarchy

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");
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) PropertyKey(net.sourceforge.processdash.hier.PropertyKey) TinyCGIException(net.sourceforge.processdash.net.http.TinyCGIException)

Aggregations

DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)56 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)40 ArrayList (java.util.ArrayList)7 ListData (net.sourceforge.processdash.data.ListData)6 List (java.util.List)5 HashMap (java.util.HashMap)4 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)4 Point (java.awt.Point)3 Iterator (java.util.Iterator)3 ProcessDashboard (net.sourceforge.processdash.ProcessDashboard)3 SimpleData (net.sourceforge.processdash.data.SimpleData)3 TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)3 IOException (java.io.IOException)2 Enumeration (java.util.Enumeration)2 HashSet (java.util.HashSet)2 LinkedList (java.util.LinkedList)2 HierarchyAlterer (net.sourceforge.processdash.hier.HierarchyAlterer)2 Prop (net.sourceforge.processdash.hier.Prop)2 DefectLog (net.sourceforge.processdash.log.defects.DefectLog)2 DefectLogID (net.sourceforge.processdash.log.defects.DefectLogID)2