throw new NullPointerException();
}
// process parameters - validate!
final ReportParameterValues parameterValues = definition.getParameterValues();
final DefaultParameterContext parameterContext = new DefaultParameterContext
(definition.getDataFactory(),
parameterValues,
ClassicEngineBoot.getInstance().getGlobalConfig(),
definition.getResourceBundleFactory(),
definition.getResourceManager(),
definition.getContextKey(),
definition.getReportEnvironment());
parameterContext.open();
try
{
final ReportParameterDefinition parameterDefinition = definition.getParameterDefinition();
final ReportParameterValidator reportParameterValidator = parameterDefinition.getValidator();
final ValidationResult validationResult =
reportParameterValidator.validate(new ValidationResult(), parameterDefinition, parameterContext);
if (validationResult.isEmpty() == false)
{
throw new ReportParameterValidationException
("The parameters provided for this report are not valid.", validationResult);
}
}
finally
{
parameterContext.close();
}
// definition: Single mail or multi-mail
final TableModel burstingData;
final DataFactory dataFactory = definition.getDataFactory();
if (definition.getBurstQuery() != null &&
dataFactory.isQueryExecutable(definition.getBurstQuery(), parameterValues))
{
burstingData = wrapWithParameters(dataFactory.queryData(definition.getBurstQuery(), parameterValues), parameterValues);
}
else
{
burstingData = wrapWithParameters(new DefaultTableModel(1, 0), parameterValues);
}
if (burstingData.getRowCount() > 0)
{
// final Transport transport = session.getTransport();
// transport.connect();
for (int i = 0; i < burstingData.getRowCount(); i++)
{
final DataRow parameterDataRow = createReportParameterDataRow(burstingData, i);
final MimeMessage message = createReport(definition, session, parameterDataRow);
parameterContext.setParameterValues(parameterDataRow);
final MailHeader[] headers = definition.getHeaders();
for (int j = 0; j < headers.length; j++)
{
final MailHeader header = headers[j];