Search in sources :

Example 21 with SimpleData

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

the class ProcessDashboard method getOwnerName.

public static String getOwnerName(DataContext data) {
    SimpleData val = data.getSimpleValue("/Owner");
    if (val == null)
        return null;
    String result = val.format();
    String defaultVal = Resources.getDashBundle("ProcessDashboard").getString("Enter_your_name");
    if (result.equals(defaultVal))
        return null;
    else
        return result;
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 22 with SimpleData

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

the class TaskScheduleChartSettings method getPreferredChartOrdering.

/**
     * In some settings, the user is given an option of selecting a subset of
     * charts and arranging them in a preferred ordering.  This method will
     * retrieve that preferred ordering for a given task list.
     */
public static List<String> getPreferredChartOrdering(String taskListID, DataRepository data) {
    SimpleData sd = data.getSimpleValue(SETTINGS_PREFIX + taskListID + CHART_ORDERING_SETTING);
    if (sd == null)
        sd = data.getSimpleValue(SETTINGS_PREFIX + GLOBAL_QUALIFIER + CHART_ORDERING_SETTING);
    ListData l = ListData.asListData(sd);
    return (l == null ? Collections.EMPTY_LIST : l.asList());
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) ListData(net.sourceforge.processdash.data.ListData)

Example 23 with SimpleData

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

the class TaskScheduleChartSettings method getSettingsForTaskList.

/**
     * Find a list of chart setting objects that apply to a particular task list.
     * 
     * @param taskListID the ID of the task list.
     * @param data the data repository
     * @return a list of
     */
public static Map<String, TaskScheduleChartSettings> getSettingsForTaskList(String taskListID, DataRepository data) {
    Map<String, TaskScheduleChartSettings> globalSettings = new HashMap();
    Map<String, TaskScheduleChartSettings> taskListSettings = new HashMap();
    String taskListPrefix = getTaskListPrefix(taskListID);
    Iterator i = data.getKeys(SETTINGS_PREFIX, DataNameFilter.EXPLICIT_ONLY);
    while (i.hasNext()) {
        String dataName = (String) i.next();
        Map dest;
        if (dataName.startsWith(GLOBAL_SETTINGS_PREFIX))
            dest = globalSettings;
        else if (dataName.startsWith(taskListPrefix))
            dest = taskListSettings;
        else
            continue;
        SimpleData sd = data.getSimpleValue(dataName);
        if (!(sd instanceof StringData))
            continue;
        try {
            StringData str = (StringData) sd;
            TaskScheduleChartSettings s = new TaskScheduleChartSettings(dataName, str.format());
            dest.put(s.getSettingsIdentifier(), s);
        } catch (Exception e) {
            TaskScheduleChart.logger.warning("Could not load chart settings for " + dataName);
        }
    }
    Map result = globalSettings;
    result.putAll(taskListSettings);
    return result;
}
Also used : HashMap(java.util.HashMap) Iterator(java.util.Iterator) SimpleData(net.sourceforge.processdash.data.SimpleData) StringData(net.sourceforge.processdash.data.StringData) HashMap(java.util.HashMap) Map(java.util.Map)

Example 24 with SimpleData

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

the class DefectTypeStandard method getNameOfMostPreferredStandard.

private static String getNameOfMostPreferredStandard() {
    if (mostPreferredName != null)
        return mostPreferredName;
    String bestName = DEFAULT_NAME;
    double bestPriority = -1;
    for (String oneName : getDefinedStandards(data)) {
        SimpleData sd = data.getSimpleValue(PRIORITY_PREFIX + oneName);
        if (sd instanceof DoubleData) {
            double onePriority = ((DoubleData) sd).getDouble();
            if (onePriority > bestPriority) {
                bestName = oneName;
                bestPriority = onePriority;
            }
        }
    }
    mostPreferredName = bestName;
    return mostPreferredName;
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) DoubleData(net.sourceforge.processdash.data.DoubleData)

Example 25 with SimpleData

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

the class TopDownBottomUpJanitor method getValueAt.

protected double getValueAt(DataContext data, PropertyKey node) {
    String fullDataName = getDataName(node);
    SimpleData sd = data.getSimpleValue(fullDataName);
    if (sd instanceof DoubleData) {
        DoubleData dd = (DoubleData) sd;
        return dd.getDouble();
    }
    return 0;
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData) DoubleData(net.sourceforge.processdash.data.DoubleData)

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