配合opentaps使用 Pentaho

出自Opentaps Wiki

跳转到: 导航, 搜索

目录

如何在pentaho框架中设计与运行报表

1. 在hot-deploy/component-load.xml取消注释来启用opentaps pentaho:

   <!-- <load-component component-location="${ofbiz.home}/hot-deploy/pentaho"/> -->

2. 修改<OPENTAPS-HOME>\hot-deploy\pentaho\webapp\pentaho\WEB-INF目录下的web.xml文件中的base-url内容参数以适合你的web网址:

   <context-param> 
     <param-name>base-url</param-name>
     <param-value>http://myweburl/pentaho</param-value>      
     <!-- 
     <param-value>http://localhost:8080/pentaho/</param-value>
     --> 
   </context-param>

3. 编辑<OPENTAPS-HOME>\hot-deploy\pentaho-solutions\system\custom\xsl目录DefaultParameterForm.xsl中的baseUrlOverride参数:

   <xsl:param name="baseUrlOverride" select="'https://myweburl/pentaho/control/'" />	

4. 下载Pentaho Report Designer (稳定版本 1.5.6) Pentaho Report Designer 1.5.6 及Pentaho Design Studio. 请参考Introducing the Pentaho Report DesignerSetting Up Parameters With the Design Studio 了解如何下载与使用这些工具.

5. 在完成报表设计后,将它发布到opentaps BI solutions repository : opentaps BI solutions repository存放于<OPENTAPS-HOME>\hot-deploy\pentaho-solutions.在以下图片显示发布在 pentaho-solutions\financials\acctgtrans 目录中的TransactionSummary报表示例.

Image:Fig1_-_Screenshot-Transaction_Summary.report_-_Designer_1.5.6_-samples-Transaction_Summary.report_-_Pentaho_Report_Designer_1.6.0.png

Image:Fig2 - Screenshot-Publish.png

配置一个数据库连接

拷贝datasource.xaction模板格式配置数据库连接,示例,在你定义的解决方案目录下<OPENTAPS-HOME>\hot-deploy\pentaho-solutions\financials\datasource.xaction按以下jdbc参数进行设置:

Image:Fig7_-_Screenshot-Resource_-_opentaps-1.0-workhorse-hot-deploy-pentaho-solutions-financials-datasource.xaction_-_Eclipse_Platform_.png

在报表中共享数据源连接配置

    在设计和发布报表之后,在Pentaho Design Studio中打开关联操作顺序脚本(<REPORT_NAME>.xaction)并按下图所示增加一个Pentaho BI Process操作:

Image:Fig3_-_Screenshot-Resource_-_opentaps-1.0-workhorse-hot-deploy-pentaho-solutions-financials-acctgtrans-TransactionSummary.xaction_-_Eclipse_Platform_.png


    XAction文件配置文本框指向datasource.xaction文件(包含数据库连接配置参数)。如下图所示在输出框插入名为shared_sql_connection类型为object的项:

Image:Fig4_-_Screenshot-Resource_-_opentaps-1.0-workhorse-hot-deploy-pentaho-solutions-financials-acctgtrans-TransactionSummary.xaction_-_Eclipse_Platform_.png

    选择执行查询的操作,按下图所示设置Database Connection Type名称下拉框中的Shared and write <shared_sql_connection>:

Image:Fig5_-_Screenshot-Resource_-_opentaps-1.0-workhorse-hot-deploy-pentaho-solutions-financials-acctgtrans-TransactionSummary.xaction_-_Eclipse_Platform_.png

在Pentaho Design Studio测试方法的顺序

    测试活动顺序,保持opentaps服务器处于运行状态,在Pentaho Design Studio中选择Test选项卡, 在Pentaho Server URL 文本框中填入 http://myserverurl/pentaho/control, 点击 Generate URL 按钮 然后 Run. 你将在屏幕中看到你的报表被执行.

Image:Fig6_-_Screenshot-Resource_-_opentaps-1.0-workhorse-hot-deploy-pentaho-solutions-financials-acctgtrans-TransactionSummary.xaction_-_Eclipse_Platform_.png

Opentaps BI中的安全设置

    Access permissions to Opentaps BI reports can be configured by associating the user login with an Opentaps security group which has REPORTING_VIEW and REPORTING_<CUSTOMIZED SECURITY_ID> permissions and then configuring an input parameter in the action sequence script (.xaction file) named permissionId with default value _<CUSTOMIZED SECURITY_ID>.

使用Pentaho Design Studio按步骤设置安全选项

  1. Click File --> Open File --> Navigate to where you have stored the ".xaction" file you created with Pentaho Report Designer, and click "OPEN". Note if it prompts you to update the file, do not update unless you are sure it will work.
  2. Under the Process Inputs section click the blue plus icon and create a type of "string"
  3. A new section called Process Input will now be created
    1. Under Name enter in "permissionId"
    2. Keep Type as "String"
  4. Under Source Of Input
    1. Click the blue plus icon and add type of "security"
    2. Delete the "request" type of Source Of Input
  5. Under Default Value
    1. Make sure the "Has Default Value" radio button is selected
    2. Inside the Default Value text box enter "_FINANCIALS"
  6. Click File --> Save

Your finished configuration should look similar to the following picture

    In the next picture we configure the TransactionSummary.xaction script with a permissionId of _FINANCIALS which maps to a REPORTING_FINANCIALS permission we associated with the user login demofinadmin :

Image:Fig8_-_Screenshot-Resource_-_opentaps-1.0-workhorse-hot-deploy-pentaho-solutions-financials-acctgtrans-TransactionSummary.xaction_-_Eclipse_Platform_.png

    Now only demofinadmin can can execute the TransactioSummary report.

Opentaps BI演示之旅

    点击查看演示网址 Opentaps BI Demo.

    先以demofinadmin密码opentaps登入,并进入到Financials solution中的Transaction Summary Demo Report.然后以demopurch1密码opentaps登入Planning solution 中的 Open Requirements CrossTab - Postgres.

    祝用得开心!

错误信息

无法移除磁盘存储

Though unlikely, you may encounter a situation where a user can run reports, but when they move back up the report tree or to the top level they encounter an error similar to this:

Error calling event: org.ofbiz.webapp.event.EventHandlerException:
Problems processing event: org.hibernate.cache.CacheException:
net.sf.ehcache.CacheException: pentahoCacheCache: Could not remove disk store
entry for 169B6E44132ED9F6A1EFB690BAA75B0D.jvm1 repositoryen_US. Error was
pentahoCache Cache: The Disk store is not active.
(net.sf.ehcache.CacheException: pentahoCacheCache: Could not remove disk store
entry for 169B6E44132ED9F6A1EFB690BAA75B0D.jvm1 repositoryen_US. Error was
pentahoCache Cache: The Disk store is not active.)

The problem is that the ehcache.jar is having problems controlling it's cache, and may only happen with a report that has a lot of elements. To fix this problem

修改cache使用ehcache

Note: with 64-bit Java 1.6 on 64-bit Linux, only the second solution below worked

  • edit [OPENTAPS_INSTALL_DIRECTORY]/hot-deploy/pentaho/config/ehcache_user.xml.
  • change the line with <diskStore path="java.io.tmpdir"/> to <diskStore path="user.home"/> or one of the other choices listed above that line.

强迫Opentaps使用/tmp目录

  • make sure [OPENTAPS_INSTALL_DIRECTORY]/hot-deploy/pentaho/config/ehcache_user.xml contains the line <diskStore path="java.io.tmpdir"/>
  • edit [OPENTAPS_INSTALL_DIRECTORY]/startofbiz.sh
  • add the following to the #VM args section
TMPDIR="-Djava.io.tmpdir=/tmp/"
  • modify the last #VM args line to include that new argument
VMARGS="$MEMIF $DEBUG $RMIIF $ADMIN $LANGUAGE $TMPDIR"

参考

1. Introducing the Pentaho Report Designer

2. Setting Up Parameters With the Design Studio



© 2008-2010 Open Source Strategies, Inc. Development of this documentation site is sponsored by Open Source Strategies, Inc.
Help support opentaps with a subscription to this documentation site.