如何从REST API导入JSON数据到BIRT?

时间:2021-01-17 00:00:18

I want to use BIRT to generate reports against data that comes from a JSON based REST API. How can I import this data?

我想使用BIRT根据来自基于JSON的REST API的数据生成报告。如何导入此数据?

1 个解决方案

#1


8  

The process for doing this is described at http://developer.actuate.com/community/forum/?app=blog&blogid=45&showentry=471, but it turns out that there are a few important steps missing. I'll fill in a few blanks here.

在http://developer.actuate.com/community/forum/?app=blog&blogid=45&showentry=471,但是有一些重要的步骤被遗漏了。我在这里填几个空格。

The original instructions describe creating a Scripted Data Source, with an "open" script that makes use of the com.actuate.json.JSONParser class. First, it is important to realise that this class is not part of BIRT, and needs to be manually added (along with any dependencies).

最初的指令描述了如何使用com. actuator .json使用“打开”脚本创建脚本化的数据源。JSONParser类。首先,必须认识到这个类不是BIRT的一部分,并且需要手动添加(以及任何依赖项)。

The download provided by the original instructions provides the com.actuate.json.JSONParser class, but leaves it up to you to source the dependencies. To make things easier I have reimplemented the JSONParser library in Maven, which will then download and package the dependencies for you. It also includes some bug fixes and enhancements like GZIP compression support. You can get the Maven project from https://github.com/mcasperson/birt-jsonparser, and to build the JSONParser library and package the dependencies, run the command

原始指令提供的下载提供了com. actuator .json。JSONParser类,但留给您自己来确定依赖项的来源。为了使事情更简单,我在Maven中重新实现了JSONParser库,它将为您下载并打包依赖项。它还包括一些bug修复和增强,如GZIP压缩支持。您可以从https://github.com/mcasperson/birt-jsonparser获得Maven项目,并构建JSONParser库并打包依赖项,运行命令

mvn clean package dependency:copy-dependencies

This will result in the birt-jsonparser-0.0.1-SNAPSHOT.jar file being created in the target directory, and all the dependencies copied into the target\dependency directory. Copy all of these JAR files into the {BIRT_INSTALL}/plugins/org.eclipse.birt.report.viewer_{BIRT_VIEWER_VERSION}/birt/scriptlib directory to allow the JSONParser class to be accessed from within your BIRT report.

这将导致birt-jsonparser- 0.01快照。在目标目录中创建jar文件,并将所有依赖项复制到目标\依赖项目录中。将所有这些JAR文件复制到{BIRT_INSTALL}/plugins/org. eclipsee .birt.report.中。viewer_{BIRT_VIEWER_VERSION}/birt/scriptlib目录允许在birt报告中访问JSONParser类。

If you want to debug your report, these JAR files will also have to be referenced in the Debug profile.

如果想要调试报表,这些JAR文件也必须在调试概要文件中引用。

如何从REST API导入JSON数据到BIRT?

#1


8  

The process for doing this is described at http://developer.actuate.com/community/forum/?app=blog&blogid=45&showentry=471, but it turns out that there are a few important steps missing. I'll fill in a few blanks here.

在http://developer.actuate.com/community/forum/?app=blog&blogid=45&showentry=471,但是有一些重要的步骤被遗漏了。我在这里填几个空格。

The original instructions describe creating a Scripted Data Source, with an "open" script that makes use of the com.actuate.json.JSONParser class. First, it is important to realise that this class is not part of BIRT, and needs to be manually added (along with any dependencies).

最初的指令描述了如何使用com. actuator .json使用“打开”脚本创建脚本化的数据源。JSONParser类。首先,必须认识到这个类不是BIRT的一部分,并且需要手动添加(以及任何依赖项)。

The download provided by the original instructions provides the com.actuate.json.JSONParser class, but leaves it up to you to source the dependencies. To make things easier I have reimplemented the JSONParser library in Maven, which will then download and package the dependencies for you. It also includes some bug fixes and enhancements like GZIP compression support. You can get the Maven project from https://github.com/mcasperson/birt-jsonparser, and to build the JSONParser library and package the dependencies, run the command

原始指令提供的下载提供了com. actuator .json。JSONParser类,但留给您自己来确定依赖项的来源。为了使事情更简单,我在Maven中重新实现了JSONParser库,它将为您下载并打包依赖项。它还包括一些bug修复和增强,如GZIP压缩支持。您可以从https://github.com/mcasperson/birt-jsonparser获得Maven项目,并构建JSONParser库并打包依赖项,运行命令

mvn clean package dependency:copy-dependencies

This will result in the birt-jsonparser-0.0.1-SNAPSHOT.jar file being created in the target directory, and all the dependencies copied into the target\dependency directory. Copy all of these JAR files into the {BIRT_INSTALL}/plugins/org.eclipse.birt.report.viewer_{BIRT_VIEWER_VERSION}/birt/scriptlib directory to allow the JSONParser class to be accessed from within your BIRT report.

这将导致birt-jsonparser- 0.01快照。在目标目录中创建jar文件,并将所有依赖项复制到目标\依赖项目录中。将所有这些JAR文件复制到{BIRT_INSTALL}/plugins/org. eclipsee .birt.report.中。viewer_{BIRT_VIEWER_VERSION}/birt/scriptlib目录允许在birt报告中访问JSONParser类。

If you want to debug your report, these JAR files will also have to be referenced in the Debug profile.

如果想要调试报表,这些JAR文件也必须在调试概要文件中引用。

如何从REST API导入JSON数据到BIRT?