Search in sources :

Example 86 with SimpleData

use of net.sourceforge.processdash.data.SimpleData 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 87 with SimpleData

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

the class DefaultDataExportFilter method processMaxDate.

private void processMaxDate(ExportedDataValue v) {
    String name = v.getName();
    if (name.endsWith("/Started") || name.endsWith("/Completed")) {
        SimpleData value = v.getSimpleValue();
        if (value instanceof DateData) {
            Date thisDate = ((DateData) value).getValue();
            maxDate = DateUtils.maxDate(maxDate, thisDate);
        }
    }
}
Also used : DateData(net.sourceforge.processdash.data.DateData) SimpleData(net.sourceforge.processdash.data.SimpleData) Date(java.util.Date)

Example 88 with SimpleData

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

the class DefaultTaskLabeler method loadMilestoneData.

private void loadMilestoneData(String path) {
    String dataName = DataRepository.createDataName(path, MILESTONES_DATA_NAME);
    SimpleData val = data.getSimpleValue(dataName);
    if (val == null || !val.test())
        return;
    Element xml;
    try {
        xml = XMLUtils.parse(val.format()).getDocumentElement();
    } catch (Exception e) {
        return;
    }
    maybeListenForDataChanges(dataName);
    XmlMilestone previous = null;
    for (Element m : XMLUtils.getChildElements(xml)) {
        XmlMilestone xm = new XmlMilestone(m, milestoneData.size());
        String id = xm.getMilestoneID();
        if (XMLUtils.hasValue(id)) {
            milestoneData.put(id, xm);
            xm.setPrevious(previous);
            previous = xm;
        }
    }
}
Also used : Element(org.w3c.dom.Element) SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 89 with SimpleData

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

the class HierarchyNoteManager method getNotesForPath.

public static Map<String, HierarchyNote> getNotesForPath(DataContext data, String path, boolean ignoreBlank) {
    String dataName = DataRepository.createDataName(path, TEAM_NOTE_DATA_NAME);
    SimpleData val = data.getSimpleValue(dataName);
    if (val == null)
        return null;
    Map<String, HierarchyNote> result;
    result = new LinkedHashMap<String, HierarchyNote>();
    try {
        result.put(NOTE_KEY, new HierarchyNote(val));
        dataName = DataRepository.createDataName(path, TEAM_NOTE_CONFLICT_DATA_NAME);
        val = data.getSimpleValue(dataName);
        if (val != null)
            result.put(NOTE_CONFLICT_KEY, new HierarchyNote(val));
        dataName = DataRepository.createDataName(path, TEAM_NOTE_LAST_SYNC_DATA_NAME);
        val = data.getSimpleValue(dataName);
        if (val != null)
            result.put(NOTE_BASE_KEY, new HierarchyNote(val));
        if (ignoreBlank && isOnlyIgnorableBlankNote(result))
            return null;
        return result;
    } catch (InvalidNoteSpecification e) {
        e.printStackTrace();
        return null;
    }
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) InvalidNoteSpecification(net.sourceforge.processdash.hier.HierarchyNote.InvalidNoteSpecification)

Example 90 with SimpleData

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

the class HierarchyNoteManager method saveNotesForPath.

public static void saveNotesForPath(DataContext data, String path, Map<String, HierarchyNote> noteData) {
    for (Map.Entry<String, HierarchyNote> e : noteData.entrySet()) {
        String dataName = null;
        if (NOTE_KEY.equals(e.getKey()))
            dataName = TEAM_NOTE_DATA_NAME;
        else if (NOTE_CONFLICT_KEY.equals(e.getKey()))
            dataName = TEAM_NOTE_CONFLICT_DATA_NAME;
        else if (NOTE_BASE_KEY.equals(e.getKey()))
            dataName = TEAM_NOTE_LAST_SYNC_DATA_NAME;
        if (dataName != null) {
            SimpleData val = null;
            if (e.getValue() instanceof HierarchyNote) {
                HierarchyNote note = (HierarchyNote) e.getValue();
                // data if it is missing
                if (dataName == TEAM_NOTE_DATA_NAME) {
                    if (note.getTimestamp() == null)
                        note.setTimestamp(new Date());
                    if (note.getAuthor() == null)
                        note.setAuthor(ProcessDashboard.getOwnerName(data));
                }
                val = (note).getAsData();
            }
            String fullDataName = DataRepository.createDataName(path, dataName);
            data.putValue(fullDataName, val);
        }
    }
    notifyListeners(path);
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) Date(java.util.Date)

Aggregations

SimpleData (net.sourceforge.processdash.data.SimpleData)164 ListData (net.sourceforge.processdash.data.ListData)20 DoubleData (net.sourceforge.processdash.data.DoubleData)15 SaveableData (net.sourceforge.processdash.data.SaveableData)14 StringData (net.sourceforge.processdash.data.StringData)13 IOException (java.io.IOException)11 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)11 DateData (net.sourceforge.processdash.data.DateData)10 Iterator (java.util.Iterator)9 List (java.util.List)7 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)7 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 ImmutableDoubleData (net.sourceforge.processdash.data.ImmutableDoubleData)6 NumberData (net.sourceforge.processdash.data.NumberData)6 Element (org.w3c.dom.Element)6 Map (java.util.Map)5 DataContext (net.sourceforge.processdash.data.DataContext)5 EscapeString (net.sourceforge.processdash.util.EscapeString)5 File (java.io.File)4