Search in sources :

Example 41 with PropertyKey

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

the class TeamProjectSetupWizard method copyNodeIDsToHierarchy.

private static boolean copyNodeIDsToHierarchy(DataContext data, DashHierarchy hier, PropertyKey key) {
    boolean madeChange = false;
    SimpleData projectID = data.getSimpleValue(DataRepository.createDataName(key.path(), TeamDataConstants.PROJECT_ID));
    if (projectID != null && projectID.test()) {
        String nodeID = projectID.format() + ":root";
        Prop p = hier.pget(key);
        if (!nodeID.equals(p.getNodeID())) {
            p.setNodeID(nodeID);
            madeChange = true;
        }
    } else {
        for (int i = hier.getNumChildren(key); i-- > 0; ) {
            PropertyKey child = hier.getChildKey(key, i);
            if (copyNodeIDsToHierarchy(data, hier, child))
                madeChange = true;
        }
    }
    return madeChange;
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) SimpleData(net.sourceforge.processdash.data.SimpleData) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 42 with PropertyKey

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

the class MigrationToolIndivLauncher method getPhaseChildren.

private List<String> getPhaseChildren(PropertyKey node) {
    List<String> result = new ArrayList<String>();
    Prop p = ctx.getHierarchy().pget(node);
    for (int i = 0; i < p.getNumChildren(); i++) {
        PropertyKey childKey = p.getChild(i);
        Prop child = ctx.getHierarchy().pget(childKey);
        String templateID = child.getID();
        if (templateID != null && templateID.contains("/PHASE/"))
            result.add(childKey.name());
    }
    return result;
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) ArrayList(java.util.ArrayList) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 43 with PropertyKey

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

the class TeamStartBootstrap method maybeSetDefaultProjectPath.

private void maybeSetDefaultProjectPath() {
    // Look for an existing, unused stub in the hierarchy.  If one is
    // found, use its name and location and exit.  Users will still be
    // able to overwrite these values; but this helps them to pick up
    // where they left off if they got confused.
    PropertyKey stub = findUnusedTeamProjectStub(getPSPProperties(), PropertyKey.ROOT);
    if (stub != null) {
        putValue(NODE_NAME, stub.name());
        putValue(NODE_LOCATION, stub.getParent().path());
        return;
    }
    // if the prefix is not set, set it to the localized default location.
    if (!StringUtils.hasValue(getValue(NODE_LOCATION))) {
        putValue(NODE_LOCATION, getDefaultProjectLocation());
    }
    // if the prefix/name points to a project that already exists (a common
    // pattern if the team leader is creating several projects in
    // succession), clear the name.
    String nodePath = getTeamNodePathOrErrToken();
    if (!nodePath.startsWith("/")) {
        putValue(NODE_NAME, (SimpleData) null);
    }
}
Also used : PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 44 with PropertyKey

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

the class McfSizeMetricApiHandler method getTargetPrefix.

/**
     * Look in the data repository and validate that the targetPath is an
     * acceptable place to store size metrics data. If so, find an empty row in
     * the Size Inventory Form, and return the complete data repository prefix
     * for that empty row.
     */
private String getTargetPrefix(SizeMetricApiRequestData request) {
    // make certain a task exists in the hierarchy at the specified path
    PropertyKey pathKey = request.ctx.getHierarchy().findExistingKey(request.targetPath);
    if (pathKey == null)
        return null;
    // make certain the task is an Indiv node within a team project
    String pathTemplateId = request.ctx.getHierarchy().getID(pathKey);
    if (!pathTemplateId.contains("/Indiv"))
        return null;
    // make certain the task is capable of storing size metrics
    if (!hasData(request, "Local_Sized_Object_List//All"))
        return null;
    // data prefix for the corresponding row
    for (int rowNum = 0; true; rowNum++) {
        String rowPrefix = SIZED_OBJ_PREFIX + "/" + rowNum;
        boolean rowHasData = false;
        for (String oneElem : DATA_ELEMS) rowHasData = rowHasData || hasData(request, rowPrefix + "/" + oneElem);
        if (!rowHasData)
            return request.targetPath + "/" + rowPrefix;
    }
}
Also used : PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 45 with PropertyKey

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

the class TaskStatusApi method getTargetPath.

/** Retrieve the target path from the incoming HTTP request */
private String getTargetPath() {
    // use the prefix, if one was supplied in the request
    String result = getPrefix();
    // selected task
    if (!StringUtils.hasValue(result)) {
        DashboardContext ctx = getDashboardContext();
        DashboardTimeLog tl = (DashboardTimeLog) ctx.getTimeLog();
        TimeLoggingModel tlm = tl.getTimeLoggingModel();
        result = tlm.getActiveTaskModel().getPath();
    }
    // verify that the named path exists and is a leaf task
    DashHierarchy hier = getPSPProperties();
    PropertyKey key = hier.findExistingKey(result);
    if (key == null)
        throw new WebApiException("no-such-task", 404, "The task '" + result + "' was not found.");
    else if (hier.getNumChildren(key) != 0)
        throw new WebApiException("not-leaf-task", 400, "The item '" + result + "' is not a leaf task.");
    return result;
}
Also used : DashboardContext(net.sourceforge.processdash.DashboardContext) DashboardTimeLog(net.sourceforge.processdash.log.time.DashboardTimeLog) TimeLoggingModel(net.sourceforge.processdash.log.time.TimeLoggingModel) DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) 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