Package com.haulmont.yarg.exception

Examples of com.haulmont.yarg.exception.DataLoadingException


            scriptParams.put("reportQuery", reportQuery);
            scriptParams.put("parentBand", parentBand);
            scriptParams.put("params", params);
            return scripting.evaluateGroovy(script, scriptParams);
        } catch (Throwable e) {
            throw new DataLoadingException(String.format("An error occurred while loading data for data set [%s]", reportQuery.getName()), e);
        }
    }
View Full Code Here


            if (parameterValue != null && StringUtils.isNotBlank(parameterValue.toString())) {
                String json = parameterValue.toString();
                String script = matcher.replaceAll("");

                if (StringUtils.isBlank(script)) {
                    throw new DataLoadingException(
                            String.format("The script doesn't contain json path expression. " +
                                    "Script [%s]", reportQuery.getScript()));
                }

                try {
                    Object scriptResult = JsonPath.read(json, script);
                    parseScriptResult(result, script, scriptResult);
                } catch (com.jayway.jsonpath.PathNotFoundException e) {
                    return Collections.emptyList();
                } catch (Throwable e) {
                    throw new DataLoadingException(
                            String.format("An error occurred while loading data with script [%s]", reportQuery.getScript()), e);
                }
            } else {
                return Collections.emptyList();
            }
        } else {
            throw new DataLoadingException(String.format("Query string doesn't contain link to parameter. " +
                    "Script [%s]", reportQuery.getScript()));
        }

        return result;
    }
View Full Code Here

                if (listObject instanceof JSONObject) {
                    for (Object object : theList) {
                        result.add(createMap((JSONObject) object));
                    }
                } else {
                    throw new DataLoadingException(
                            String.format("The list collected with script does not contain objects. " +
                                    "It contains %s instead. " +
                                    "Script [%s]", listObject, script));
                }
            }
        } else if (scriptResult instanceof JSONObject) {
            result.add(createMap((JSONObject) scriptResult));
        } else {
            throw new DataLoadingException(
                    String.format("The script collects neither object nor list of objects. " +
                            "Script [%s]", script));
        }
    }
View Full Code Here

            Map<String, Object> outputValues = new HashMap<String, Object>();
            if (resultRecordObject instanceof Object[]) {
                Object[] resultRecord = (Object[]) resultRecordObject;

                if (resultRecord.length != parametersNames.size()) {
                    throw new DataLoadingException(String.format("Result set size [%d] does not match output fields count [%s]. Detected output fields %s", resultRecord.length, parametersNames.size(), parametersNames));
                }

                for (Integer i = 0; i < resultRecord.length; i++) {
                    OutputValue outputValue = parametersNames.get(i);
                    Object value = resultRecord[i];
View Full Code Here

                        outputValue.setSynonym(matcher.group(1));
                    }
                }
            });
        } catch (Throwable e) {
            throw new DataLoadingException(String.format("An error occurred while loading data for data set [%s]", reportQuery.getName()), e);
        }

        return fillOutputData(resList, outputValues);
    }
View Full Code Here

                                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++) {
View Full Code Here

            ReportDataLoader dataLoader = loaderFactory.createDataLoader(reportQuery.getLoaderType());
            return dataLoader.loadData(reportQuery, parentBand, paramsMap);
        } catch (ValidationException e) {
            throw e;
        } catch (Exception e) {
            throw new DataLoadingException(String.format("An error occurred while loading data for band [%s] and query [%s].", band.getName(), reportQuery.getName()), e);
        }
    }
View Full Code Here

TOP

Related Classes of com.haulmont.yarg.exception.DataLoadingException

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.