Search in sources :

Example 1 with ValidationException

use of com.haulmont.yarg.exception.ValidationException in project jmix by jmix-framework.

the class JmixGroovyDataLoader method loadData.

@Override
public List<Map<String, Object>> loadData(ReportQuery reportQuery, BandData parentBand, Map<String, Object> params) {
    try {
        String script = reportQuery.getScript();
        Map<String, Object> scriptParams = groovyScriptParametersProvider.prepareParameters(reportQuery, parentBand, params);
        script = StringUtils.trim(script);
        if (script.endsWith(".groovy")) {
            script = resources.getResourceAsString(script);
        }
        return scripting.evaluateGroovy(script, scriptParams);
    } catch (ValidationException e) {
        throw e;
    } catch (Throwable e) {
        throw new DataLoadingException(String.format("An error occurred while loading data for data set [%s]", reportQuery.getName()), e);
    }
}
Also used : DataLoadingException(com.haulmont.yarg.exception.DataLoadingException) ValidationException(com.haulmont.yarg.exception.ValidationException)

Aggregations

DataLoadingException (com.haulmont.yarg.exception.DataLoadingException)1 ValidationException (com.haulmont.yarg.exception.ValidationException)1