[Fix] Properly initialize GenericReport

This commit is contained in:
Robert von Burg 2017-03-27 14:39:03 +02:00
parent 7ee002adcf
commit 537c6ea8d0
1 changed files with 7 additions and 7 deletions

View File

@ -70,6 +70,12 @@ public class GenericReport {
public GenericReport(StrolchTransaction tx, String reportId) {
this.tx = tx;
this.reportId = reportId;
// get the report
this.report = this.tx.getResourceBy(TYPE_REPORT, this.reportId, true);
this.columnsBag = this.report.getParameterBag(BAG_COLUMNS, true);
this.columnIds = this.columnsBag.getParameterKeySet();
this.dateRangeSelP = this.report.getParameter(BAG_PARAMETERS, PARAM_DATE_RANGE_SEL);
}
public GenericReport dateRange(DateRange dateRange) {
@ -113,12 +119,6 @@ public class GenericReport {
public Stream<Map<String, StrolchRootElement>> buildStream() {
// get the report
this.report = this.tx.getResourceBy(TYPE_REPORT, this.reportId);
this.columnsBag = this.report.getParameterBag(BAG_COLUMNS);
this.columnIds = this.columnsBag.getParameterKeySet();
this.dateRangeSelP = this.report.getParameter(BAG_PARAMETERS, PARAM_DATE_RANGE_SEL);
// query the main objects and return a stream
return queryRows().map(e -> evaluateRow(e)).filter(e -> filter(e));
}
@ -126,7 +126,7 @@ public class GenericReport {
public Stream<ReportElement> doReport() {
return buildStream().map(e -> new ReportElement(this.columnIds, columnId -> {
StringParameter columnDefP = (StringParameter) this.columnsBag.getParameter(columnId);
StringParameter columnDefP = (StringParameter) this.columnsBag.getParameter(columnId, true);
return evaluateColumnValue(columnDefP, e);
}));
}