我有一个使用ReportLibraries中的组件动态组合BIRT ReportDesigns的环境。这些ReportLibraries存储在数据库中,不会在文件系统的任何位置找到。将BIRT库引入InputStream报告(BIRT DEAPI)
我所试图做的是在一个会话打开一个图书馆,让图书馆的名称,(从测试资源的FileInputStream)的InputStream
SessionHandle session = de.newSessionHandle(ULocale.ENGLISH);
LibraryHandle library = session.openLibrary("lib01.rptlibrary", is);
然后,我创建一个ReportDesign和包括库(由名字?)
ReportDesignHandle reportDesign = session.createDesign();
reportDesign.includeLibrary("lib01.rptlibrary", "lib01");
后来我就在库中搜索表元素,并尝试复制到设计:
ElementFactory elementFactory = reportDesign.getElementFactory();
DesignElementHandle deh1 = library.findElement("NewTable");
DesignElementHandle ldeh1 = elementFactory.newElementFrom(deh1, "newTable");
在这一点上,我会得到以下异常:
org.eclipse.birt.report.model.api.command.InvalidParentException: The library for the parent element "Table("NewTable")" is not included.
at org.eclipse.birt.report.model.api.ElementFactoryImpl.newElementFrom(ElementFactoryImpl.java:968)
at org.eclipse.birt.report.model.api.ElementFactory.newElementFrom(ElementFactory.java:1)
好像图书馆被发现,DesignElementHandle确实指向,我想复制到设计中的组成部分,但在库中打开ReportDesign无法找到该会话。
有什么办法可以告诉ReportDesign从非FileSystem资源中包含Library,或者从Session中包含Library,因为它具有相同的名称?
我想避免必须将我的FielSystem上的rptlibrary文件不惜一切代价组装ReportDesign。
我不能回答你的问题,但你的环境的想法听起来很有趣。有没有关于它的公开信息? – hvb
@hvb不幸的是,我无法公开比我在这里写的更多。有什么具体的,你想知道这个项目? – mwhs
这只是因为它听起来与我有的想法相似,但缺乏实现的资源:让数据库应用程序中的高级用户通过组装预定义组件创建报告;所有这些都存储在数据库中(包括版本控制,权限管理等)。 – hvb