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");
}
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));
}
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;
}
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");
}
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);
}
}
}
Aggregations