use of org.entirej.framework.report.data.controllers.EJReportParameter in project rap by entirej.
the class EJRWTApplicationManager method generateReport.
public String generateReport(String reportName, EJParameterList parameterList) {
if (reportManager == null) {
reportManager = EJReportFrameworkInitialiser.initialiseFramework("report.ejprop");
}
EJReport report;
if (parameterList == null) {
report = reportManager.createReport(reportName);
} else {
EJReportParameterList list = new EJReportParameterList();
Collection<EJFormParameter> allParameters = parameterList.getAllParameters();
for (EJFormParameter parameter : allParameters) {
EJReportParameter reportParameter = new EJReportParameter(parameter.getName(), parameter.getDataType());
reportParameter.setValue(parameter.getValue());
list.addParameter(reportParameter);
}
report = reportManager.createReport(reportName, list);
}
EJReportRunner reportRunner = reportManager.createReportRunner();
String output = reportRunner.runReport(report);
return output;
}
use of org.entirej.framework.report.data.controllers.EJReportParameter in project rap by entirej.
the class EJRWTApplicationManager method runReportAsync.
@Override
public void runReportAsync(final String reportName, final EJParameterList parameterList, final EJMessage completedMessage) {
if (reportManager == null) {
reportManager = EJReportFrameworkInitialiser.initialiseFramework("report.ejprop");
}
final Display display = Display.getDefault();
final ServerPushSession pushSession = new ServerPushSession();
Runnable job = new Runnable() {
@Override
public void run() {
try {
final EJReport report;
if (parameterList == null) {
report = reportManager.createReport(reportName);
} else {
EJReportParameterList list = new EJReportParameterList();
Collection<EJFormParameter> allParameters = parameterList.getAllParameters();
for (EJFormParameter parameter : allParameters) {
EJReportParameter reportParameter = new EJReportParameter(parameter.getName(), parameter.getDataType());
reportParameter.setValue(parameter.getValue());
list.addParameter(reportParameter);
}
report = reportManager.createReport(reportName, list);
}
EJReportRunner reportRunner = reportManager.createReportRunner();
final String output = reportRunner.runReport(report);
if (!display.isDisposed()) {
display.asyncExec(new Runnable() {
public void run() {
String name = report.getName();
EJReportParameter reportParameter = null;
if (report.hasReportParameter("REPORT_NAME")) {
reportParameter = report.getReportParameter("REPORT_NAME");
}
if (reportParameter != null && reportParameter.getValue() != null && !((String) reportParameter.getValue()).isEmpty()) {
name = (String) reportParameter.getValue();
} else {
if (report.getOutputName() != null && !report.getOutputName().isEmpty()) {
name = report.getOutputName();
}
}
if (completedMessage != null) {
handleMessage(completedMessage);
}
String ext = report.getProperties().getExportType().toString().toLowerCase();
report.getProperties().getExportType();
if (report.getProperties().getExportType() == EJReportExportType.XLSX_LARGE) {
ext = EJReportExportType.XLSX.toString().toLowerCase();
}
EJRWTImageRetriever.getGraphicsProvider().open(output, String.format("%s.%s", name, ext));
}
});
}
} finally {
display.asyncExec(new Runnable() {
public void run() {
pushSession.stop();
}
});
}
}
};
pushSession.start();
Thread bgThread = new Thread(job);
bgThread.setDaemon(true);
bgThread.start();
}
use of org.entirej.framework.report.data.controllers.EJReportParameter in project rap by entirej.
the class EJRWTApplicationManager method runReport.
public void runReport(String reportName, EJParameterList parameterList) {
if (reportManager == null) {
reportManager = EJReportFrameworkInitialiser.initialiseFramework("report.ejprop");
}
EJReport report;
if (parameterList == null) {
report = reportManager.createReport(reportName);
} else {
EJReportParameterList list = new EJReportParameterList();
Collection<EJFormParameter> allParameters = parameterList.getAllParameters();
for (EJFormParameter parameter : allParameters) {
EJReportParameter reportParameter = new EJReportParameter(parameter.getName(), parameter.getDataType());
reportParameter.setValue(parameter.getValue());
list.addParameter(reportParameter);
}
report = reportManager.createReport(reportName, list);
}
EJReportRunner reportRunner = reportManager.createReportRunner();
String output = reportRunner.runReport(report);
String name = report.getName();
EJReportParameter reportParameter = null;
if (report.hasReportParameter("REPORT_NAME")) {
reportParameter = report.getReportParameter("REPORT_NAME");
}
if (reportParameter != null && reportParameter.getValue() != null && !((String) reportParameter.getValue()).isEmpty()) {
name = (String) reportParameter.getValue();
} else {
if (report.getOutputName() != null && !report.getOutputName().isEmpty()) {
name = report.getOutputName();
}
}
String ext = report.getProperties().getExportType().toString().toLowerCase();
report.getProperties().getExportType();
if (report.getProperties().getExportType() == EJReportExportType.XLSX_LARGE) {
ext = EJReportExportType.XLSX.toString().toLowerCase();
}
EJRWTImageRetriever.getGraphicsProvider().open(output, String.format("%s.%s", name, ext));
}
Aggregations