Package com.haulmont.yarg.structure

Examples of com.haulmont.yarg.structure.ReportQuery


    }

    protected List<Map<String, Object>> getQueriesResult(ReportBand band, BandData parentBand, Map<String, Object> params, Collection<ReportQuery> reportQueries) {
        List<Map<String, Object>> result;
        Iterator<ReportQuery> queryIterator = reportQueries.iterator();
        ReportQuery firstReportQuery = queryIterator.next();

        //gets data from first dataset
        result = getQueryData(parentBand, band, firstReportQuery, params);

        //adds data from second and following datasets to result
        while (queryIterator.hasNext()) {
            ReportQuery reportQuery = queryIterator.next();
            List<Map<String, Object>> currentQueryData = getQueryData(parentBand, band, reportQuery, params);
            String link = reportQuery.getLinkParameterName();
            if (StringUtils.isNotBlank(link)) {
                for (Map<String, Object> currentRow : currentQueryData) {
                    Object linkObj = currentRow.get(link);
                    if (linkObj != null) {
                        for (Map<String, Object> resultRow : result) {
                            Object linkObj2 = resultRow.get(link);
                            if (linkObj2 != null) {
                                if (linkObj.equals(linkObj2)) {
                                    resultRow.putAll(currentRow);
                                    break;
                                }
                            } else {
                                throw new DataLoadingException(String.format("An error occurred while loading data for band [%s]." +
                                        " Query defines link parameter [%s] but result does not contain such field. Query [%s].", band.getName(), link, firstReportQuery.getName()));
                            }
                        }
                    } else {
                        throw new DataLoadingException(String.format("An error occurred while loading data for band [%s]." +
                                " Query defines link parameter [%s] but result does not contain such field. Query [%s].", band.getName(), link, reportQuery.getName()));
                    }
                }
            } else {
                for (int j = 0; (j < result.size()) && (j < currentQueryData.size()); j++) {
                    result.get(j).putAll(currentQueryData.get(j));
View Full Code Here

TOP

Related Classes of com.haulmont.yarg.structure.ReportQuery

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.