我正在对一个应用程序进行一些规划,该应用程序使用 Mondrian OLAP 引擎和 Olap4j,并且应该向用户呈现/显示数据。我了解所有后端内容,但我不确定应该如何在视图层中显示数据。
例如,olap4j 有一个格式化程序,可以将 SELECT 很好地打印到控制台中。
我从olap4j获取的数据如何显示在视图层中?我刚刚浏览了olap4j API,似乎没有任何东西可以以可以某种方式进一步处理和显示的形式获取结果。这个过程是 Pentaho 解决方案的一部分吗?那么,仅从 Mondrian OLAP 引擎和 olap4j 呈现数据真的不容易吗?
编辑:我习惯传统上从数据库获取一些数据到我的 DTO 中并将其显示在视图层中。但是如何为如此复杂的结果集创建 DTO?
I'm doing a little bit of planning of an application that uses Mondrian OLAP engine with Olap4j and should present/display data to user. I understand all the back-end stuff, but I'm not sure how should I display the data in the view layer.
For example olap4j has a formatter that prints the SELECT nicely into the console.
How is the data that I get from olap4j displayed in view layer ? I just went through the olap4j API, and there doesn't seem to be anything for getting the result in a form that can be somehow further processed and displayed. Is this process part of the Pentaho solution ? So that otherwise it is really not easy to present data just from Mondrian OLAP engine and olap4j ?
EDIT: I'm used to traditionally get some data from a database into my DTO and display it in view layer. But how do I create DTOs for such a complicated result set ?
发布评论
评论(1)
您可以创建自己的视图层,只是有点棘手。
OlapStatement.executeOlapQuery() 返回一个 CellSet,您必须使用它。另请阅读规范,这是一个很好的信息来源。
这是一个创建
List
的示例(不是最好的表示,但很容易理解它是如何工作的)。这将创建一个类似于 http://www.olap4j.org/api/index 的表。 html?org/olap4j/Position.html(没有“性别”和“产品”标签)。>
使用这些构造函数创建 MyCell 类:
不要忘记显示过滤器,请使用 Cellset.getFilterAxis() 来实现。
您还可以检查矩形 SourceForge 上的格式化程序,但它有点长。
You can create your own view layer it's just a little bit tricky.
OlapStatement.executeOlapQuery() returns a CellSet, you will have to work with that. Also read the specifications, it's a good source of information.
Here is an example, that creates
List<List<MyCell>>
(not the best representation but it's easy to undarstand how it works). This creates a table similar to http://www.olap4j.org/api/index.html?org/olap4j/Position.html (without the "Gender" and "Product" labels).Create the MyCell class with these constructors:
Don't forget to display the filters, use Cellset.getFilterAxis() for that.
You can also check the Rectangular formatter on SourceForge, but it's a bit longer.