use of net.sourceforge.processdash.data.StringData in project processdash by dtuma.
the class SelectWBSFilterIndiv method putValue.
private void putValue(String name, String value) {
String dataName = DataRepository.createDataName(getPrefix(), name);
// save the value of the new filter
StringData val = (value == null ? null : StringData.create(value));
getDataRepository().putValue(dataName, val);
// add a listener to prevent the data element from being disposed
getDataRepository().addDataListener(dataName, WBS_FILTER_KEEPER, false);
}
use of net.sourceforge.processdash.data.StringData in project processdash by dtuma.
the class TaskListDataWatcher method addTaskListNames.
private void addTaskListNames(ExportedDataValue val) {
SimpleData d = val.getSimpleValue();
if (!d.test())
return;
ListData list = null;
if (d instanceof ListData)
list = (ListData) d;
else if (d instanceof StringData)
list = ((StringData) d).asList();
if (list != null)
for (int i = 0; i < list.size(); i++) taskListNames.add(list.get(i));
}
use of net.sourceforge.processdash.data.StringData in project processdash by dtuma.
the class McfSizeMetricApiHandler method validateAndStoreData.
/**
* Retrieve the size data parameters from the incoming request and ensure
* they represent valid size metric data. If so, write them into the data
* repository.
*
* @param request
* the request we are processing
* @param dataPrefix
* the data repository prefix where metrics should be stored
*/
private void validateAndStoreData(SizeMetricApiRequestData request, String dataPrefix) {
// parse and validate the supplied parameter values
StringData description = getDescription(request);
StringData sizeUnits = getSizeUnits(request);
DoubleData actSize = getActualSize(request);
// store them into the data repository
putData(request, dataPrefix + "/" + DESCRIPTION_ELEM, description);
putData(request, dataPrefix + "/" + UNITS_ELEM, sizeUnits);
putData(request, dataPrefix + "/" + ACT_SIZE_ELEM, actSize);
}
use of net.sourceforge.processdash.data.StringData in project processdash by dtuma.
the class TimingMetricsRecorderTest method testCleanupBogusElements.
public void testCleanupBogusElements() throws Exception {
// the mere act of creating the recorder should have initialized
// all times to their correct values
assertTimes(expectedTimes);
// add a bogus value to the data repository
StringData stringData = new StringData("\"foo");
data.putValue("/Project/Time", new DoubleData(666, false));
data.putValue("/Non Project/Time", stringData);
// but we don't want it to show up.
expectedTimes.put("/Project", new Integer(0));
boolean timesMatch = false;
try {
assertTimes(expectedTimes);
timesMatch = true;
} catch (AssertionFailedError afe) {
}
assertFalse("expected times NOT to match", timesMatch);
// this should cause things to get cleaned up
recorder.timeLogChanged(new TimeLogEvent(timeLog));
assertTimes(expectedTimes);
assertSame(stringData, data.getValue("/Non Project/Time"));
}
use of net.sourceforge.processdash.data.StringData in project processdash by dtuma.
the class EVTaskDependency method getTaskIDs.
public static List getTaskIDs(DataContext data, String taskPath) {
String dataName = DataRepository.createDataName(taskPath, TASK_ID_DATA_NAME);
SimpleData currentValue = data.getSimpleValue(dataName);
ListData list = null;
if (currentValue == null || currentValue.test() == false)
return null;
if (currentValue instanceof ListData)
list = (ListData) currentValue;
else if (currentValue instanceof StringData)
list = ((StringData) currentValue).asList();
else
return null;
List result = new LinkedList();
for (int i = 0; i < list.size(); i++) result.add(list.get(i));
if (!result.isEmpty())
return result;
else
return null;
}
Aggregations