Package net.sourceforge.processdash.data

Examples of net.sourceforge.processdash.data.ListData


        List args =  collapseLists(arguments, 2);

        if (start < 0) start = 0;
        if (end < 0 || end > args.size()) end = args.size();

        ListData result = new ListData();
        if (start < end) {
            Iterator i = args.subList(start, end).iterator();
            while (i.hasNext())
                result.add(i.next());
        }

        return result;
    }
View Full Code Here


     *
     * This method <b>must</b> be thread-safe.
     */
    public Object call(List arguments, ExpressionContext context)
    {
        ListData result = new ListData();

        String name = asString(getArg(arguments, 0));
        if (name == null) return null;

        Iterator i = collapseLists(arguments, 1).iterator();
        String path, dataName;
        while (i.hasNext()) {
            path = asStringVal(i.next());
            if (path == null) continue;

            dataName = DataRepository.createDataName(path, name);
            result.addAll(asList(context.get(dataName)));
        }
        return result;
    }
View Full Code Here

        // retrieve the criteria that should be used to narrow the query
        List criteria = collapseLists(arguments, 0);

        try {
            ListData result = new ListData();
            calcCompletedTasks(context, criteria, result);
            calcCompletedComponents(queryRunner, criteria, result);
            return result;

        } catch (Exception e) {
View Full Code Here

            prefix = context.get(ExpressionContext.PREFIXVAR_NAME).format();

        if (prefix == null) return null;
       
        try {
            ListData hierItem = (ListData) context
                    .get(DashHierarchy.DATA_REPOSITORY_NAME);
            DashHierarchy hier = (DashHierarchy) hierItem.get(0);
           
            PropertyKey key = hier.findExistingKey(prefix);
            if (key == null) return null;
           
            ListData result = new ListData();
            for (int i = 0;  i < hier.getNumChildren(key);  i++) {
                PropertyKey child = hier.getChildKey(key, i);
                result.add(child.path());
            }
            return result;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
View Full Code Here

        // get the list of values that we should iterate over. This can be
        // specified either as a list literal using the "values" attribute,
        // or via a list variable using the "list" attribute.
        String values = foreach.getAttribute("values");
        ListData list;
        if (isNull(values)) {
            String listName = foreach.getAttribute("list");
            list = getList(listName);
        } else {
            list = new ListData(values);
        }

        // iterate over the list and calculate the resulting contents.
        String loopIndex = foreach.getAttribute("name");
        String loopContents = text.substring(foreach.end, endfor.begin);
        StringBuffer replacement = new StringBuffer();
        for (int i = 0;   i < list.size();   i++) {
            Object oneVal = list.get(i);
            String strVal = (oneVal == null ? "" : oneVal.toString());
            String iterResults = StringUtils.findAndReplace(loopContents,
                    loopIndex, strVal);
            replacement.append(iterResults);
        }
View Full Code Here

            listName = trimDelim(listName);
            SimpleData d = getSimpleValue(listName);
            if (d instanceof ListData)   return (ListData) d;
            if (d instanceof StringData) return ((StringData) d).asList();
            if (d instanceof SimpleData) {
                ListData result = new ListData();
                result.add(d.format());
            }
            return EMPTY_LIST;
        } else {
            // listName names an environment variable or parameter
            ListData result = new ListData();

                                // try for an environment variable first.
            Object envVal = env.get(listName);
            if (envVal instanceof String) {
                result.add((String) envVal);
                return result;
            }
                                // look for a parameter value.
            Object allParam = params.get(listName + "_ALL");
            if (allParam instanceof String[]) {
                String[] param = (String[]) allParam;
                for (int i = 0;   i < param.length;   i++)
                    result.add(param[i]);
            } else {
                Object p = params.get(listName);
                if (p == null) p = getResource(listName);
                if (p instanceof String) {
                    String paramVal = (String) p;
                    if (paramVal.startsWith("LIST="))
                        return new ListData(paramVal.substring(5));
                    else
                        result.add(paramVal);
                }
            }

            return result;
        }
View Full Code Here

TOP

Related Classes of net.sourceforge.processdash.data.ListData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.