use of org.pentaho.reporting.engine.classic.core.parameters.DefaultParameterContext in project head by mifos.
the class PentahoReportsServiceImpl method validate.
private void validate(MasterReport report, List<PentahoValidationError> errors) throws ReportProcessingException {
ReportParameterDefinition paramDefinition = report.getParameterDefinition();
ReportParameterValidator validator = paramDefinition.getValidator();
ParameterContext paramContext = new DefaultParameterContext(report);
ValidationResult validationResult = validator.validate(null, paramDefinition, paramContext);
for (ValidationMessage msg : validationResult.getErrors()) {
PentahoValidationError error = new PentahoValidationError(msg.getMessage());
errors.add(error);
}
String[] properties = validationResult.getProperties();
for (String prop : properties) {
for (ValidationMessage msg : validationResult.getErrors(prop)) {
PentahoValidationError error = new PentahoValidationError(prop, msg.getMessage());
errors.add(error);
}
}
}
use of org.pentaho.reporting.engine.classic.core.parameters.DefaultParameterContext in project head by mifos.
the class PentahoParamParser method parseReportParams.
public List<AbstractPentahoParameter> parseReportParams(MasterReport report, HttpServletRequest request, Map<String, AbstractPentahoParameter> selectedValues, boolean update) {
ParameterContext paramContext = null;
try {
paramContext = new DefaultParameterContext(report);
ReportParameterDefinition paramDefinition = report.getParameterDefinition();
List<AbstractPentahoParameter> result = new ArrayList<AbstractPentahoParameter>();
for (ParameterDefinitionEntry paramDefEntry : paramDefinition.getParameterDefinitions()) {
result.add(parseParam(paramDefEntry, paramContext, selectedValues, update));
}
return result;
} catch (ReportDataFactoryException ex) {
throw new JNDIException("Problem with Pentaho Reports", request);
} catch (Exception ex) {
throw new MifosRuntimeException(ex);
} finally {
if (paramContext != null) {
try {
paramContext.close();
} catch (ReportDataFactoryException ex) {
logger.error("Exception while closing parameter context", ex);
}
}
}
}
Aggregations