查询嵌入式报表引擎日志



我在Java应用程序中集成了报表引擎。我最近将petaho报告升级到3.8.2。我在这次升级中遇到了一个问题,所以我打开了pentaho日志,看看发生了什么。我得到了以下相关日志有人能解释一下它的意思吗?我从这些日志中假设数据工厂无法找到我的查询参数的值并设置为null。如果是这样,我不明白,为什么会这样,因为在代码中,我在主报告中设置了这些参数值,如下所示。类似地,我正在设置其他参数值。

vReport.getParameterValues().put("propertyId", pPropertyId);

我说的日志在这里。

Sep 20 16:00:44,540 DEBUG SimpleSQLReportDataFactory - [ IP=0:0:0:0:0:0:0:1, Property=72, Req=6 ] - Detected parameter:[dateFormat, dateFormat, dateFormat, dateTimeFormat, dateTimeFormat, bookedFrom, bookedTo, propertyId]
Sep 20 16:00:44,561 DEBUG SimpleSQLReportDataFactory - [ IP=0:0:0:0:0:0:0:1, Property=72, Req=6 ] - Parametrize: 1 set to <null>
Sep 20 16:00:44,561 DEBUG SimpleSQLReportDataFactory - [ IP=0:0:0:0:0:0:0:1, Property=72, Req=6 ] - Parametrize: 2 set to <null>
Sep 20 16:00:44,562 DEBUG SimpleSQLReportDataFactory - [ IP=0:0:0:0:0:0:0:1, Property=72, Req=6 ] - Parametrize: 3 set to <null>
Sep 20 16:00:44,562 DEBUG SimpleSQLReportDataFactory - [ IP=0:0:0:0:0:0:0:1, Property=72, Req=6 ] - Parametrize: 4 set to <null>
Sep 20 16:00:44,563 DEBUG SimpleSQLReportDataFactory - [ IP=0:0:0:0:0:0:0:1, Property=72, Req=6 ] - Parametrize: 5 set to <null>
Sep 20 16:00:44,563 DEBUG SimpleSQLReportDataFactory - [ IP=0:0:0:0:0:0:0:1, Property=72, Req=6 ] - Parametrize: 6 set to <null>
Sep 20 16:00:44,564 DEBUG SimpleSQLReportDataFactory - [ IP=0:0:0:0:0:0:0:1, Property=72, Req=6 ] - Parametrize: 7 set to <null>
Sep 20 16:00:44,564 DEBUG SimpleSQLReportDataFactory - [ IP=0:0:0:0:0:0:0:1, Property=72, Req=6 ] - Parametrize: 8 set to <null>

Pentaho Reporting只有在报表上声明适当的参数时才会使用您的参数值。只添加随机的名称-值对是行不通的。

所以至少声明你想要使用的所有参数。在最通用的版本中,假设您自己对用户输入进行了适当的验证,并且可以保证传入的值是安全有效的,则可以对所有参数使用以下代码:

final ModifiableReportParameterDefinition parameterDefinition =
    (ModifiableReportParameterDefinition) report.getParameterDefinition();
parameterDefinition.addParameterDefinition(new PlainParameter("dataFormat", Object.class));

最新更新