Search in sources :

Example 1 with ReportExecution

use of io.jmix.reports.entity.ReportExecution in project jmix by jmix-framework.

the class ReportRunnerImpl method run.

@Override
public ReportOutputDocument run(ReportRunContext context) {
    prepareContext(context);
    if (!reportsProperties.isHistoryRecordingEnabled()) {
        return createReportDocumentInternal(context);
    }
    ReportExecution reportExecution = executionHistoryRecorder.startExecution(context.getReport(), context.getParams());
    try {
        ReportOutputDocument document = createReportDocumentInternal(context);
        executionHistoryRecorder.markAsSuccess(reportExecution, document);
        return document;
    } catch (ReportCanceledException e) {
        executionHistoryRecorder.markAsCancelled(reportExecution);
        throw e;
    } catch (Exception e) {
        executionHistoryRecorder.markAsError(reportExecution, e);
        throw e;
    }
}
Also used : ReportOutputDocument(com.haulmont.yarg.reporting.ReportOutputDocument) ReportExecution(io.jmix.reports.entity.ReportExecution) ReportingInterruptedException(com.haulmont.yarg.exception.ReportingInterruptedException) NoFreePortsException(com.haulmont.yarg.formatters.impl.doc.connector.NoFreePortsException) OpenOfficeException(com.haulmont.yarg.exception.OpenOfficeException)

Example 2 with ReportExecution

use of io.jmix.reports.entity.ReportExecution in project jmix by jmix-framework.

the class ReportExecutionHistoryRecorderImpl method startExecution.

@Override
public ReportExecution startExecution(Report report, Map<String, Object> params) {
    ReportExecution execution = metadata.create(ReportExecution.class);
    execution.setReport(report);
    execution.setReportName(report.getName());
    execution.setReportCode(report.getCode());
    execution.setUsername(currentAuthentication.getUser().getUsername());
    execution.setStartTime(timeSource.currentTimestamp());
    setParametersString(execution, params);
    handleNewReportEntity(execution);
    execution = dataManager.save(execution);
    return execution;
}
Also used : ReportExecution(io.jmix.reports.entity.ReportExecution)

Aggregations

ReportExecution (io.jmix.reports.entity.ReportExecution)2 OpenOfficeException (com.haulmont.yarg.exception.OpenOfficeException)1 ReportingInterruptedException (com.haulmont.yarg.exception.ReportingInterruptedException)1 NoFreePortsException (com.haulmont.yarg.formatters.impl.doc.connector.NoFreePortsException)1 ReportOutputDocument (com.haulmont.yarg.reporting.ReportOutputDocument)1