use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.
the class EditSubprojectList method getSimpleValue.
/** Get a value from the data repository. */
protected SimpleData getSimpleValue(String name) {
DataRepository data = getDataRepository();
String prefix = getPrefix();
if (prefix == null)
prefix = "";
String dataName = DataRepository.createDataName(prefix, name);
SimpleData d = data.getSimpleValue(dataName);
return d;
}
use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.
the class EditSubprojectList method putValue.
protected void putValue(String name, SimpleData dataValue) {
DataRepository data = getDataRepository();
String prefix = getPrefix();
if (prefix == null)
prefix = "";
String dataName = DataRepository.createDataName(prefix, name);
data.putValue(dataName, dataValue);
}
use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.
the class HandleFormAbstract method handleRegistration.
private void handleRegistration() throws IOException {
log.entering("HandleForm", "handleRegistration");
log.finer("query=" + env.get("QUERY_STRING"));
DataRepository data = getDataRepository();
String prefix = getDataPrefix();
boolean unlocked = getUnlocked();
if (!requiredTagOK(data, prefix)) {
data = null;
prefix = "No such project OR project/process mismatch";
}
FormDataSession session = new FormDataSession(data, prefix, unlocked);
handleRegistrationImpl(session);
}
use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.
the class GenericPlanSummaryForm method writeContents.
protected void writeContents() throws IOException {
StringBuffer uri = new StringBuffer((String) env.get("SCRIPT_PATH"));
uri.setLength(uri.length() - 6);
uri.append(".shtm");
String unit, units;
DataRepository data = getDataRepository();
String prefix = getPrefix();
SimpleData d = data.getSimpleValue(prefix + "/" + UNITS_NAME);
units = (d != null ? d.format() : null);
if (units == null || units.trim().length() == 0)
units = resources.getString("Default_Units");
int semicolonPos = units.indexOf(';');
if (semicolonPos > -1) {
unit = units.substring(0, semicolonPos);
units = units.substring(semicolonPos + 1);
} else if (units.endsWith("s")) {
unit = units.substring(0, units.length() - 1);
} else {
unit = units;
}
HTMLUtils.appendQuery(uri, "Unit", unit);
HTMLUtils.appendQuery(uri, "Units", units);
DashHierarchy props = getPSPProperties();
PropertyKey self = props.findExistingKey(getPrefix());
int numPhases = props.getNumChildren(self);
for (int i = 0; i < numPhases; i++) HTMLUtils.appendQuery(uri, "Phases", props.getChildKey(self, i).name());
String text = getRequestAsString(uri.toString());
out.write(text);
}
use of net.sourceforge.processdash.data.repository.DataRepository in project processdash by dtuma.
the class DefectUtil method getWorkflowDefectPhases.
/**
* If the given path is part of a team workflow, return a list of phases
* that are appropriate for defect injection/removal.
*
* @param taskPath
* the path of a task within the dashboard
* @param context
* the dashboard context
* @return a list of phases appropriate for the containing workflow.
*/
public static DefectPhaseList getWorkflowDefectPhases(String taskPath, DashboardContext context) {
// retrieve the workflow info for the current project. If no workflow
// info is found, return null.
DataRepository data = context.getData();
WorkflowInfo workflowInfo = WorkflowInfoFactory.get(data, taskPath);
if (workflowInfo == null || workflowInfo.isEmpty())
return null;
// check to see if this is a PSP task.
String path = taskPath;
String parentPath = DataRepository.chopPath(taskPath);
String phaseSuffix = null;
if (isPspTask(data, parentPath)) {
phaseSuffix = taskPath.substring(parentPath.length());
path = parentPath;
} else if (isPspTask(data, taskPath)) {
phaseSuffix = "/Code";
taskPath += "/Code";
}
// see if the current task came from a (potentially nested) workflow.
// If so, create (potentially nested) workflow phase objects to
// represent all of the enclosing workflow tasks.
Map<String, DefectPhase> enclosingPhases = new HashMap();
while (path != null) {
// see if this task represents a phase in a workflow.
String workflowId = getWorkflowID(data, path);
if (workflowId != null && phaseSuffix != null)
workflowId += phaseSuffix;
Phase phase = workflowInfo.getPhase(workflowId);
if (phase == null)
// not a workflow phase. We are done.
break;
// represent subdivided tasks.)
if (!enclosingPhases.containsKey(phase.getPhaseId())) {
// task. Update their phase IDs to document this relationship.
for (DefectPhase dp : enclosingPhases.values()) dp.phaseID = phase.getPhaseId() + "," + dp.phaseID;
// enclosing phases
for (Phase onePhase : phase.getWorkflow().getPhases()) {
DefectPhase dp = new DefectPhase(onePhase);
enclosingPhases.put(onePhase.getPhaseId(), dp);
}
}
// step up to the parent and look for enclosing phases there, too
path = DataRepository.chopPath(path);
phaseSuffix = null;
}
// now that we have found the root of this enactment, scan all tasks
// underneath to find any other workflows that are represented. Add
// them to our result in the order they appear.
DefectPhaseList result = new DefectPhaseList();
result.workflowInfo = workflowInfo;
if (!enclosingPhases.isEmpty()) {
DashHierarchy hier = context.getHierarchy();
result.workflowRoot = hier.findExistingKey(path);
scanForWorkflowTasks(data, hier, result.workflowRoot, null, getDevelopmentPhases(data, path), result, new HashSet(), enclosingPhases, taskPath);
// set the default injection phase, if necessary
if (result.defaultRemovalPhase == -1)
result.defaultInjectionPhase = -1;
else if (result.defaultInjectionPhase == -1)
result.defaultInjectionPhase = result.defaultRemovalPhase - 1;
}
return result;
}
Aggregations