Search in sources :

Example 6 with StringData

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);
}
Also used : StringData(net.sourceforge.processdash.data.StringData)

Example 7 with StringData

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));
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) StringData(net.sourceforge.processdash.data.StringData) ListData(net.sourceforge.processdash.data.ListData) EVTaskListData(net.sourceforge.processdash.ev.EVTaskListData)

Example 8 with StringData

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);
}
Also used : StringData(net.sourceforge.processdash.data.StringData) DoubleData(net.sourceforge.processdash.data.DoubleData)

Example 9 with StringData

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"));
}
Also used : StringData(net.sourceforge.processdash.data.StringData) AssertionFailedError(junit.framework.AssertionFailedError) DoubleData(net.sourceforge.processdash.data.DoubleData)

Example 10 with StringData

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;
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) NodeList(org.w3c.dom.NodeList) List(java.util.List) StringData(net.sourceforge.processdash.data.StringData) ImmutableStringData(net.sourceforge.processdash.data.ImmutableStringData) LinkedList(java.util.LinkedList) ListData(net.sourceforge.processdash.data.ListData)

Aggregations

StringData (net.sourceforge.processdash.data.StringData)26 ListData (net.sourceforge.processdash.data.ListData)15 SimpleData (net.sourceforge.processdash.data.SimpleData)13 ArrayList (java.util.ArrayList)3 List (java.util.List)3 DoubleData (net.sourceforge.processdash.data.DoubleData)3 ImmutableStringData (net.sourceforge.processdash.data.ImmutableStringData)3 MalformedValueException (net.sourceforge.processdash.data.MalformedValueException)3 SaveableData (net.sourceforge.processdash.data.SaveableData)3 EscapeString (net.sourceforge.processdash.util.EscapeString)3 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 LinkedList (java.util.LinkedList)2 Map (java.util.Map)2 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)2 EVTaskListData (net.sourceforge.processdash.ev.EVTaskListData)2 LocalizedString (net.sourceforge.processdash.util.LocalizedString)2 NodeList (org.w3c.dom.NodeList)2 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1