use of net.sourceforge.processdash.data.SaveableData in project processdash by dtuma.
the class DefectUtil method getDefectPhaseList.
/**
* Return the same information as
* {@link #getDefectPhases(String, DashboardContext)}, but in the form of a
* DefectPhaseList.
*/
public static DefectPhaseList getDefectPhaseList(String defectPath, String taskPath, DashboardContext context) {
List<String> phaseNames = getDefectPhases(defectPath, context);
String removalPhase = guessRemovalPhase(defectPath, taskPath, context);
String injectionPhase = guessInjectionPhase(phaseNames, removalPhase, taskPath, context);
String processName = null;
SaveableData sd = context.getData().getInheritableValue(taskPath, TeamDataConstants.PROCESS_NAME);
if (sd != null)
processName = sd.getSimpleValue().format();
DefectPhaseList result = new DefectPhaseList();
for (String onePhase : phaseNames) {
DefectPhase dp = new DefectPhase(onePhase);
dp.processName = processName;
if (onePhase.equals(injectionPhase))
result.defaultInjectionPhase = result.size();
if (onePhase.equals(removalPhase))
result.defaultRemovalPhase = result.size();
result.add(dp);
}
return result;
}
use of net.sourceforge.processdash.data.SaveableData in project processdash by dtuma.
the class TimingMetricsRecorder method saveTiming.
protected boolean saveTiming(String basePath) {
Map timings = getTimings(basePath);
if (timings == null)
return false;
for (Iterator i = timings.entrySet().iterator(); i.hasNext(); ) {
Map.Entry e = (Map.Entry) i.next();
String pathName = (String) e.getKey();
long[] pathValue = (long[]) e.getValue();
String timeElementName = DataRepository.createDataName(pathName, "Time");
String orphanElementName = DataRepository.createDataName(pathName, "Orphaned Time");
SaveableData currentVal = data.getValue(timeElementName);
SaveableData orphanedVal = data.getValue(orphanElementName);
if (pathValue == null) {
if (orphanedVal != null)
// if a previous orphan value exists, clear it.
data.putValue(orphanElementName, null);
if (currentVal == null)
// the data repository agrees with us. All is well.
continue;
else if (!(currentVal instanceof DoubleData) || (currentVal instanceof NumberFunction))
// there. Leave it alone.
continue;
else
// there is an existing number there; erase it.
data.putValue(timeElementName, null);
} else if (approver.isTimeLoggingAllowed(pathName) == false) {
// the time log has entries for this path, but the time isn't
// supposed to be logged there. Record it as orphaned time.
allPathsTouched.add(pathName);
storeNumberIfChanged(orphanElementName, orphanedVal, pathValue);
} else {
allPathsTouched.add(pathName);
storeNumberIfChanged(timeElementName, currentVal, pathValue);
if (orphanedVal != null)
data.putValue(orphanElementName, null);
}
}
return true;
}
use of net.sourceforge.processdash.data.SaveableData in project processdash by dtuma.
the class ImportedDefectManager method rerootPath.
private static String rerootPath(DataRepository data, String defectPath, Map wbsIdMap) {
SaveableData wbsIdValue = data.getInheritableValue(defectPath, "Project_WBS_ID");
if (wbsIdValue == null)
return defectPath;
SimpleData wbsIdSimpleValue = wbsIdValue.getSimpleValue();
if (wbsIdSimpleValue == null)
return defectPath;
String wbsID = wbsIdSimpleValue.format();
while (wbsID != null && wbsID.length() > 0) {
String result = (String) wbsIdMap.get(wbsID);
if (result != null)
return result;
wbsID = DataRepository.chopPath(wbsID);
}
return defectPath;
}
use of net.sourceforge.processdash.data.SaveableData in project processdash by dtuma.
the class TaskStatusApi method storeCompletionDate.
private void storeCompletionDate(String path, String newDateParam) {
DateData newDate = null;
if (!"".equals(newDateParam) && !"null".equals(newDateParam)) {
try {
Date d;
if ("now".equals(newDateParam))
d = new Date();
else
d = WebApiUtils.DATE_FMT.parse(newDateParam);
newDate = new DateData(d, true);
} catch (ParseException e) {
throw new WebApiException("parameter-invalid", 400, "The 'completionDate' parameter value '" + newDateParam + "' is not a valid date.").causedBy(e).putAttr("param", "completionDate");
}
}
String dataName = path + "/Completed";
SaveableData currentDate = getDataContext().getValue(dataName);
if (currentDate != null && !(currentDate instanceof DateData))
throw new WebApiException("date-not-editable", 400, "The completion date is not editable for task '" + path + "'.");
getDataContext().putValue(dataName, newDate);
}
use of net.sourceforge.processdash.data.SaveableData in project processdash by dtuma.
the class EVTask method taskIsPruned.
public static boolean taskIsPruned(DataRepository data, String taskListName, String taskPath) {
SaveableData d = data.getInheritableValue(taskPath, TASK_PRUNING_PREFIX + taskListName);
int pruningFlag = INFER_FROM_CONTEXT;
if (d != null && d.getSimpleValue() instanceof NumberData)
pruningFlag = ((NumberData) d.getSimpleValue()).getInteger();
return pruningFlag == USER_PRUNED;
}
Aggregations