Search in sources :

Example 36 with PropertyKey

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

the class SizeEstimatingTemplate method migrateLegacyData.

/**
     * Perform cleanup operations on data that was collected using Process
     * Dashboard 1.10.4 or earlier.
     * 
     * Versions of the dashboard up through and including version 1.10.4
     * used the <tt>search()</tt> function in their datafile to make lists of
     * base additions, new objects, and reused objects. The search() function
     * is very expensive and inefficient, so this was replaced by a new
     * strategy using precomputed lists where data is known to have been
     * recorded. This method will migrate legacy data to the new strategy if
     * it has not already been migrated.
     * 
     * @param hierarchy the hierarchy of dashboard tasks
     * @param data the data repository
     */
public static void migrateLegacyData(DashHierarchy hierarchy, DataRepository data) {
    if (Settings.getBool(SET_FLAG_SETTING, false))
        return;
    for (Iterator i = hierarchy.keySet().iterator(); i.hasNext(); ) {
        PropertyKey key = (PropertyKey) i.next();
        String path = key.path();
        maybeMigrateLegacyData(data, path);
    }
    InternalSettings.set(SET_FLAG_SETTING, "true");
}
Also used : Iterator(java.util.Iterator) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 37 with PropertyKey

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

the class DefaultTimeLoggingModel method setCurrentPhase.

protected void setCurrentPhase(PropertyKey newCurrentPhase) {
    PropertyKey oldPhase = currentPhase;
    if (newCurrentPhase != null && newCurrentPhase.equals(oldPhase))
        return;
    logger.log(Level.FINE, "setting current phase to {0}", (newCurrentPhase == null ? "null" : newCurrentPhase.path()));
    if (currentTimeLogEntry != null)
        addToRecentPaths(currentPhase.path());
    saveAndReleaseCurrentTimeLogEntry();
    if (newCurrentPhase != null)
        currentPhase = newCurrentPhase;
    activeTaskDate = new Date();
    if (!paused)
        startTiming();
    propertyChangeSupport.firePropertyChange(ACTIVE_TASK_PROPERTY, getPhasePath(oldPhase), getPhasePath(currentPhase));
}
Also used : PropertyKey(net.sourceforge.processdash.hier.PropertyKey) Date(java.util.Date)

Example 38 with PropertyKey

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

the class DefectUtil method getDefectPhases.

/** Return the list of phases that should be displayed in a drop-down
     * list for selection as defect injection and removal phases.
     * 
     * @param defectPath the path to a task in the dashboard hierarchy
     * @param context the dashboard context
     * @return a list of phases
     */
public static List getDefectPhases(String defectPath, DashboardContext context) {
    int prefixLength = 0;
    List result = new ArrayList();
    Enumeration leafNames = getInheritedPhaseList(defectPath, context.getData());
    if (leafNames == null) {
        DashHierarchy hier = context.getHierarchy();
        PropertyKey defectPathKey = hier.findExistingKey(defectPath);
        if (defectPathKey == null)
            return result;
        leafNames = hier.getLeafNames(defectPathKey);
        prefixLength = defectPath.length() + 1;
    }
    while (leafNames.hasMoreElements()) {
        String item = (String) leafNames.nextElement();
        if (item == null || item.length() <= prefixLength)
            continue;
        item = item.substring(prefixLength);
        // forbid defects could set their flag to false. But this will work...
        if (item.endsWith("Postmortem") || item.endsWith("Reassessment"))
            // don't add to the list.
            continue;
        result.add(item);
    }
    return result;
}
Also used : Enumeration(java.util.Enumeration) DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 39 with PropertyKey

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

the class MigrateTeamProject method findProject.

/**
     * Locates the enclosing team project, and sets the values of the
     * {@link #projectRoot} and {@link #processID} fields accordingly. If there
     * is no enclosing team project, both will be set to null.
     */
private void findProject() throws MigrationException {
    DashHierarchy hierarchy = getPSPProperties();
    PropertyKey key = hierarchy.findExistingKey(getPrefix());
    while (key != null) {
        String templateID = hierarchy.getID(key);
        if (templateID != null && templateID.endsWith(MASTER_ROOT)) {
            throw new MigrationException("notNeededMaster");
        }
        if (templateID != null && templateID.endsWith(TEAM_ROOT)) {
            projectRoot = key.path();
            processID = templateID.substring(0, templateID.length() - TEAM_ROOT.length());
            isTeam = true;
            convertToProcessID = null;
            if (getBooleanValue("Team_Project_Migration_Complete"))
                throw new MigrationException("alreadyUpgraded");
            if (getBooleanValue("Individuals_Using_Stubless_Phases"))
                throw new MigrationException("upgradeNotNeeded");
            return;
        }
        if (templateID != null && templateID.endsWith(INDIV_ROOT)) {
            projectRoot = key.path();
            processID = templateID.substring(0, templateID.length() - INDIV_ROOT.length());
            convertToProcessID = getStringValue(CONVERT_DATA_NAME);
            isTeam = false;
            return;
        }
        if (templateID != null && templateID.endsWith(INDIV2_ROOT)) {
            projectRoot = key.path();
            processID = templateID.substring(0, templateID.length() - INDIV2_ROOT.length());
            convertToProcessID = getStringValue(CONVERT_DATA_NAME);
            if (StringUtils.hasValue(convertToProcessID))
                return;
            if (getBooleanValue("Team_Project_Migration_Complete"))
                throw new MigrationException("alreadyUpgraded");
            else
                throw new MigrationException("upgradeNotNeeded");
        }
        key = key.getParent();
    }
    throw new MigrationException("notTeamProject");
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 40 with PropertyKey

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

the class TeamStartNotifier method checkAlreadyJoined.

private static void checkAlreadyJoined(DashboardContext ctx, PropertyKey key, String projectID) {
    String dataName = DataRepository.createDataName(key.path(), PROJECT_ID);
    SimpleData sd = ctx.getData().getSimpleValue(dataName);
    if (sd != null && projectID.equals(sd.format())) {
        throw new AlreadyJoinedException();
    } else {
        DashHierarchy hier = ctx.getHierarchy();
        int i = hier.getNumChildren(key);
        while (i-- > 0) {
            PropertyKey childKey = hier.getChildKey(key, i);
            checkAlreadyJoined(ctx, childKey, projectID);
        }
    }
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) SimpleData(net.sourceforge.processdash.data.SimpleData) 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