use of net.sourceforge.processdash.data.DataContext in project processdash by dtuma.
the class ScanItemListBulkHandler method writeContents.
@Override
protected void writeContents() throws IOException {
parseFormData();
String[] itemIDs = (String[]) parameters.get("id_ALL");
boolean checked = "true".equals(parameters.get("checked"));
DateData valueToStore = checked ? new DateData() : null;
DataContext data = getDataContext();
for (String itemID : itemIDs) {
if (!checkValidID(itemID))
throw new TinyCGIException(400, "Bad item ID");
data.putValue(itemID, valueToStore);
}
out.write("OK");
}
use of net.sourceforge.processdash.data.DataContext in project processdash by dtuma.
the class TimeLogProblemReport method writeContents.
@Override
protected void writeContents() throws IOException {
out.println(HEADER);
DataContext data = getDataContext();
ProcessUtil process = new ProcessUtil(data);
List phases = process.getProcessListPlain("Phase_List");
phases = process.filterPhaseList(phases);
List<String> missingPhases = new ArrayList<String>();
for (Iterator i = phases.iterator(); i.hasNext(); ) {
String phase = (String) i.next();
if (getBoolParam("Check" + phase)) {
SimpleData phaseTime = data.getSimpleValue(phase + "/Time");
if (phaseTime == null || !phaseTime.test())
missingPhases.add(phase);
}
}
if (missingPhases.isEmpty()) {
printStudentDataOK(res().getString("OK_Message"));
} else {
String missingPhaseStr = joinList(missingPhases, "or");
String message = getParameter("Message");
if (!StringUtils.hasValue(message))
message = res().getString("Default_Error_Message");
message = StringUtils.findAndReplace(message, "[PHASES]", missingPhaseStr);
printStudentDataError(message);
}
out.println(FOOTER);
}
use of net.sourceforge.processdash.data.DataContext in project processdash by dtuma.
the class MoveProjectWorker method saveNewDataValues.
/*
* Methods to update the values in the data repository
*/
private void saveNewDataValues() {
DataContext data = ctx.getData().getSubcontext(projectPrefix);
saveDataValue(data, TeamDataConstants.TEAM_DIRECTORY, newTeamDir);
saveDataValue(data, TeamDataConstants.TEAM_DIRECTORY_UNC, newTeamDirUNC);
RepairImportInstruction.maybeRepairForTeam(data);
}
use of net.sourceforge.processdash.data.DataContext in project processdash by dtuma.
the class SyncWBS method precacheWbsImportDirectory.
private void precacheWbsImportDirectory() {
DataContext data = getDataRepository().getSubcontext(projectRoot);
SimpleData d = data.getSimpleValue(TeamDataConstants.TEAM_DATA_DIRECTORY);
String dir = (d == null ? null : d.format());
d = data.getSimpleValue(TeamDataConstants.TEAM_DATA_DIRECTORY_URL);
String url = (d == null ? null : d.format());
ImportDirectoryFactory.getInstance().get(url, dir);
}
use of net.sourceforge.processdash.data.DataContext in project processdash by dtuma.
the class ProbeItemSizeHistogram method buildData.
@Override
protected void buildData() {
int[] histogram = new int[SIZE_NAMES.size()];
DataContext data = getDataContext();
ListData partsAdditions = ListData.asListData(data.getSimpleValue(PARTS_LIST));
if (partsAdditions != null) {
for (int i = 0; i < partsAdditions.size(); i++) {
String path = asString(partsAdditions.get(i));
double itemCount = asDoubleData(data.getSimpleValue(path + METHODS));
String relSize = asString(data.getSimpleValue(path + REL_SIZE));
if (!StringUtils.hasValue(relSize) && itemCount == 0)
continue;
int relSizePos = SIZE_NAMES.indexOf(relSize);
if (relSizePos == -1)
relSizePos = UNCATEGORIZED_POS;
if (itemCount == 0)
itemCount = 1;
histogram[relSizePos]++;
}
}
// if no items were present in the "[BLANK]" category, don't show it.
int len = histogram.length;
if (histogram[len - 1] == 0)
len--;
ResultSet result = new ResultSet(len, 1);
result.setColName(0, "");
result.setColName(1, "Total # Items");
for (int i = 0; i < len; i++) {
result.setRowName(i + 1, SIZE_NAMES.get(i));
result.setData(i + 1, 1, new DoubleData(histogram[i]));
}
this.data = result;
}
Aggregations