Search in sources :

Example 96 with ListData

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

the class ResultSet method getList.

private static ListData getList(DataRepository data, String forParam, String[] conditions, String orderBy, String basePrefix) {
    // construct an applicable ResultSetSearchExpression.
    ResultSetSearchExpression rsse = new ResultSetSearchExpression(data, forParam, basePrefix, conditions, orderBy);
    // see if someone else has already generated a list name for
    // our ResultSetSearchExpression.  If not, generate one.
    String listName;
    synchronized (listNames) {
        listName = (String) listNames.get(rsse);
        if (listName == null) {
            int num = listNumber++;
            listName = DataRepository.createDataName(FAKE_DATA_NAME, "List" + num);
            listNames.put(rsse, listName);
        }
    }
    // fetch the value of the named list.
    ListData result = lookupList(data, listName);
    // save it in the repository.
    if (result == null)
        synchronized (listName) {
            result = lookupList(data, listName);
            if (result == null) {
                String expression = rsse.buildExpression();
                try {
                    data.putExpression(listName, "", expression);
                } catch (MalformedValueException mve) {
                    System.err.println("malformed value!");
                    data.putValue(listName, new ListData());
                }
                data.addDataListener(listName, NULL_LISTENER);
                result = lookupList(data, listName);
            }
        }
    return result;
}
Also used : MalformedValueException(net.sourceforge.processdash.data.MalformedValueException) LocalizedString(net.sourceforge.processdash.util.LocalizedString) ListData(net.sourceforge.processdash.data.ListData)

Example 97 with ListData

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

the class DefectUtil method getInheritedPhaseList.

protected static Enumeration getInheritedPhaseList(String defectPath, DataRepository data) {
    Object inheritedPhaseList = data.getInheritableValue(defectPath, "Effective_Defect_Phase_List");
    ListData list = null;
    if (inheritedPhaseList instanceof ListData)
        list = (ListData) inheritedPhaseList;
    else if (inheritedPhaseList instanceof StringData)
        list = ((StringData) inheritedPhaseList).asList();
    if (list == null)
        return null;
    Vector result = new Vector();
    for (int i = 0; i < list.size(); i++) result.add(list.get(i).toString());
    return result.elements();
}
Also used : StringData(net.sourceforge.processdash.data.StringData) Vector(java.util.Vector) ListData(net.sourceforge.processdash.data.ListData)

Example 98 with ListData

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

the class DefectAnalyzer method run.

public static void run(DashHierarchy props, DataRepository data, String prefix, Map queryParameters, Task t) {
    if (queryParameters.containsKey(DB_MODE_PARAM)) {
        DatabasePlugin plugin = QueryUtils.getDatabasePlugin(data);
        ListData criteria = getDatabaseCriteria(data, prefix, queryParameters);
        String pid = getProcessID(data, prefix);
        if (plugin != null && criteria != null && pid != null)
            ImportedDefectManager.run(plugin, criteria.asList(), pid, t);
    } else {
        String[] prefixes = ResultSet.getPrefixList(data, queryParameters, prefix);
        boolean includeChildren = !queryParameters.containsKey(NO_CHILDREN_PARAM);
        run(props, data, prefixes, includeChildren, t);
    }
}
Also used : DatabasePlugin(net.sourceforge.processdash.tool.db.DatabasePlugin) ListData(net.sourceforge.processdash.data.ListData)

Example 99 with ListData

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

the class DefectAnalyzer method getDatabaseCriteria.

private static ListData getDatabaseCriteria(DataRepository data, String prefix, Map queryParameters) {
    String dataName = (String) queryParameters.get("for");
    if (dataName.startsWith("[") && dataName.endsWith("]"))
        dataName = dataName.substring(1, dataName.length() - 1);
    dataName = DataRepository.createDataName(prefix, dataName);
    ListData criteria = ListData.asListData(data.getSimpleValue(dataName));
    return criteria;
}
Also used : ListData(net.sourceforge.processdash.data.ListData)

Example 100 with ListData

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

the class EditSubprojectList method doAdd.

/*
     * Methods to handle values posted to this form
     */
private void doAdd() throws IOException {
    Map subprojects = getSubprojects();
    ListData validSubprojects = findValidSubprojectNames();
    String shortName = getParameter(SHORT_NAME);
    String path = getParameter(PATH);
    String shortNameError = validateShortName(null, shortName, subprojects);
    String pathError = validatePath(null, path, subprojects, validSubprojects);
    if (shortNameError != null || pathError != null) {
        // there are problems with the values entered.  Send the user
        // back to the add page to try again.
        showAddPage(shortName, shortNameError, path, pathError);
        return;
    }
    int i = 0;
    while (getValue(i, SHORT_NAME) != null) i++;
    String num = getNum(i);
    logger.log(Level.FINE, "Master project {0} adding subproject [{1} => {2}]", new Object[] { getPrefix(), shortName, path });
    putValue(num, SHORT_NAME, shortName.trim());
    putValue(num, PATH, path);
    recalcDependentData();
    writeCloseWindow(true);
}
Also used : LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) ListData(net.sourceforge.processdash.data.ListData)

Aggregations

ListData (net.sourceforge.processdash.data.ListData)129 SimpleData (net.sourceforge.processdash.data.SimpleData)20 ArrayList (java.util.ArrayList)18 List (java.util.List)16 Iterator (java.util.Iterator)15 StringData (net.sourceforge.processdash.data.StringData)15 EVTaskListData (net.sourceforge.processdash.ev.EVTaskListData)9 Map (java.util.Map)8 HashSet (java.util.HashSet)7 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)6 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 LinkedList (java.util.LinkedList)5 DoubleData (net.sourceforge.processdash.data.DoubleData)5 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)5 LocalizedString (net.sourceforge.processdash.util.LocalizedString)5 NodeList (org.w3c.dom.NodeList)5 Date (java.util.Date)4 EVTaskList (net.sourceforge.processdash.ev.EVTaskList)4 Element (org.w3c.dom.Element)4