如何将JSON数据从REST API导入BIRT? [英] How can I import JSON data from a REST API into BIRT?

查看:234
本文介绍了如何将JSON数据从REST API导入BIRT?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用BIRT针对基于JSON的REST API的数据生成报告.如何导入这些数据?

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

推荐答案

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.

原始说明描述了如何创建脚本数据源,以及使用com.actuate.json.JSONParser类的开放"脚本.首先,必须意识到该类不是BIRT的一部分,并且需要手动添加(以及任何依赖项).

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.actuate.json.JSONParser类,但将其留给您来提供依赖项.为了使事情变得容易,我在Maven中重新实现了JSONParser库,该库随后将为您下载并打包依赖项.它还包括一些错误修复和增强功能,例如GZIP压缩支持.您可以从 https://github.com/mcasperson/birt-jsonparser 获取Maven项目. ,并构建JSONParser库并打包依赖项,请运行命令

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

mvn clean package dependency:copy-dependencies

这将导致在 target 目录中创建 birt-jsonparser-0.0.1-SNAPSHOT.jar 文件,并将所有依赖项复制到 target \ dependency 目录.将所有这些JAR文件复制到 {BIRT_INSTALL}/plugins/org.eclipse.birt.report.viewer_ {BIRT_VIEWER_VERSION}/birt/scriptlib 目录中,以允许从内部访问JSONParser类您的BIRT报告.

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.

如果要调试报告,则还必须在调试"配置文件中引用这些JAR文件.

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

这篇关于如何将JSON数据从REST API导入BIRT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆