Search in sources :

Example 11 with StringData

use of net.sourceforge.processdash.data.StringData in project processdash by dtuma.

the class EVTaskDependency method addTaskIDs.

public static void addTaskIDs(DataContext data, String taskPath, String id) {
    if (id == null || id.length() == 0)
        return;
    String dataName = DataRepository.createDataName(taskPath, TASK_ID_DATA_NAME);
    SimpleData currentValue = data.getSimpleValue(dataName);
    ListData newValue;
    if (currentValue instanceof ListData)
        newValue = (ListData) currentValue;
    else if (currentValue instanceof StringData)
        newValue = ((StringData) currentValue).asList();
    else
        newValue = new ListData();
    boolean valueChanged = false;
    String[] idList = id.split(",");
    for (int i = 0; i < idList.length; i++) {
        if (newValue.setAdd(idList[i]))
            valueChanged = true;
    }
    if (valueChanged)
        data.putValue(dataName, newValue);
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) StringData(net.sourceforge.processdash.data.StringData) ImmutableStringData(net.sourceforge.processdash.data.ImmutableStringData) ListData(net.sourceforge.processdash.data.ListData)

Example 12 with StringData

use of net.sourceforge.processdash.data.StringData in project processdash by dtuma.

the class EVTaskListData method getSchedule.

private EVSchedule getSchedule(DataRepository data, String taskListName) {
    String globalPrefix = MAIN_DATA_PREFIX + taskListName;
    String dataName = DataRepository.createDataName(globalPrefix, EST_HOURS_DATA_NAME);
    SimpleData d = data.getSimpleValue(dataName);
    if (d instanceof StringData)
        d = ((StringData) d).asList();
    if (d instanceof ListData) {
        String lockedName = DataRepository.createDataName(globalPrefix, DATES_LOCKED_DATA_NAME);
        SimpleData l = data.getSimpleValue(lockedName);
        boolean locked = (l != null && l.test());
        return new EVSchedule((ListData) d, locked);
    } else
        return new EVSchedule();
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) StringData(net.sourceforge.processdash.data.StringData) ListData(net.sourceforge.processdash.data.ListData)

Example 13 with StringData

use of net.sourceforge.processdash.data.StringData in project processdash by dtuma.

the class EVTaskListRollup method addTaskListsFromData.

private void addTaskListsFromData(DataRepository data, DashHierarchy hierarchy, ObjectCache cache, String taskListName, boolean willNeedChangeNotification) {
    String globalPrefix = MAIN_DATA_PREFIX + taskListName;
    String dataName = DataRepository.createDataName(globalPrefix, TASK_LISTS_DATA_NAME);
    SimpleData listVal = data.getSimpleValue(dataName);
    ListData list = null;
    if (listVal instanceof ListData)
        list = (ListData) listVal;
    else if (listVal instanceof StringData)
        list = ((StringData) listVal).asList();
    if (list == null)
        return;
    for (int i = 0; i < list.size(); i++) {
        taskListName = (String) list.get(i);
        EVTaskList taskList = openTaskListToAdd(taskListName, data, hierarchy, cache, willNeedChangeNotification);
        if (taskList == null) {
            if (EVTaskListXML.validName(taskListName))
                taskList = new EVTaskListXML(taskListName);
            else
                continue;
        }
        if (((EVTask) root).add((EVTask) taskList.getRoot()))
            evTaskLists.add(taskList);
    }
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) StringData(net.sourceforge.processdash.data.StringData) ListData(net.sourceforge.processdash.data.ListData)

Example 14 with StringData

use of net.sourceforge.processdash.data.StringData in project processdash by dtuma.

the class HierarchySynchronizer method getProcessDataList.

private List getProcessDataList(String name) {
    List result = new LinkedList();
    String dataName = "/" + processID + "/" + name;
    SimpleData val = data.getSimpleValue(dataName);
    if (val instanceof StringData)
        val = ((StringData) val).asList();
    if (val instanceof ListData) {
        ListData l = (ListData) val;
        for (int i = 0; i < l.size(); i++) result.add(l.get(i));
    }
    return result;
}
Also used : List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) EVTaskList(net.sourceforge.processdash.ev.EVTaskList) NodeList(org.w3c.dom.NodeList) SimpleData(net.sourceforge.processdash.data.SimpleData) StringData(net.sourceforge.processdash.data.StringData) LinkedList(java.util.LinkedList) ListData(net.sourceforge.processdash.data.ListData) EVTaskListData(net.sourceforge.processdash.ev.EVTaskListData)

Example 15 with StringData

use of net.sourceforge.processdash.data.StringData in project processdash by dtuma.

the class DashboardTimeLogTest method createModels.

protected void createModels() throws Exception {
    tempDir = createTempDir();
    DashboardTimeLog dashboardTimeLog = new DashboardTimeLog(tempDir, data, hier);
    String dataName = DataRepository.createDataName(PATH4, "Time");
    data.putValue(dataName, new StringData("\"foo"));
    approver = dashboardTimeLog;
    timeLog = dashboardTimeLog;
    timeLoggingModel = (DefaultTimeLoggingModel) dashboardTimeLog.getTimeLoggingModel();
}
Also used : StringData(net.sourceforge.processdash.data.StringData)

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