use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class MethodsPage method getNum.
protected SimpleData getNum(String qual, String name, double mult) {
String inputFieldName = qual + name;
String inputFieldValue = (String) params.get(inputFieldName);
SimpleData result = N_A;
try {
double value = Double.parseDouble(inputFieldValue);
if (!Double.isInfinite(value) && !Double.isNaN(value))
result = new DoubleData(value * mult);
} catch (NumberFormatException nfe) {
}
return result;
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class ProbeData method shouldOnlyIncludeCompletedProjects.
private boolean shouldOnlyIncludeCompletedProjects(DataRepository data, String prefix) {
String dataName = DataRepository.createDataName(prefix, PROBE_ONLY_COMPLETED_NAME);
SimpleData d = data.getSimpleValue(dataName);
if (d != null && d.test() == false)
return false;
else
return true;
}
use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.
the class ProbeData method saveLastRunValue.
private void saveLastRunValue(int col) {
String elem = getDataName(col, true);
String dataName = DataRepository.createDataName(prefix, elem);
SimpleData sd = data.getSimpleValue(dataName);
dataName = DataRepository.createDataName(prefix, PROBE_LAST_RUN_PREFIX + elem);
data.userPutValue(dataName, sd);
}
use of net.sourceforge.processdash.data.SimpleData 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.SimpleData in project processdash by dtuma.
the class StudentProfileValidator method checkValues.
private boolean checkValues() {
String owner = getOwner();
if (owner == null || owner.trim().length() == 0)
return false;
DataContext c = getDataContext();
for (String name : NAMES_TO_CHECK) {
SimpleData sd = c.getSimpleValue(name);
if (sd == null || !sd.test() || sd.format().trim().length() == 0)
return false;
}
c.putValue("../Student_Profile_Complete", ImmutableDoubleData.TRUE);
if (c.getSimpleValue("Completed") == null)
c.putValue("Completed", new DateData());
return true;
}
Aggregations