View Full Version : How to impl Report Template Versioning Capability in Report Designer and PUC

04-20-2012, 12:28 AM
Dear Folk,
I would like to hear the standard approach to support versioning of report templates.
When I create a report in Report Designer or in User Console, I would like to check into SVN and the CI would pick the updated template from SVN and publish it to BI Server (instead of directly publishing the template from RD/PUC into BI Server).
I understand we need to tweak Report Designer and PUC. I am looking for a standard implementation approach for this feature.


04-20-2012, 05:38 AM
No need to tweak anything. Personally, I "publish" by saving the file directly into the solution directory and then triggering a solution-repository refresh manually.

PRD's publish is just a copy operation - there is no magic.

Therefore: If you use SVN to sync your directories, then all you need to do is:

(1) save to your local working copy
(2) commit
(3) on the server: Update your server's working copy
(4) refresh the solution repository.

There is no service reachable from outside to refresh the repository via an URL call, so you have to write yourself an XAction to do that job. Then call the XAction.
Use this piece of JavaScript to make the refresh (you must be admin to make that call).

var session = Packages.org.pentaho.platform.engine.core.system.PentahoSessionHolder.getSession();
Packages.org.pentaho.platform.engine.core.system.PentahoSystem.getSolutionRepository(session).reloadSolutionRepository(session, 3);

04-20-2012, 08:57 AM
Hi Taqua,
Thank you for your response.
Step-1. Check in
Can we add a Menu Item in Report Designer say "Commit to SVN" and when clicking on the "Commit to SVN" will use the SVNKit to commit to the SVN Server.
Step-22. Check out in Server
CI build use Ant to checkout the Report Template.

If I want to implement Step-1, please describe what are the steps I need to follow (except calling SVNKit API's).

thank you in advance,

04-20-2012, 09:01 AM
Step1: Yes, you start with: Download the source from SVN, implement a action, register it via the Xul file found in the sources.
SVN Url: http://source.pentaho.org/pentaho-reporting/tools/report-designer/

Have a look at the existing actions in PRD - actions are javax.swing.Action instances, so only standard java knowledge required here.

04-20-2012, 09:51 AM
Dear Taqua,
Wrote an Sample Action Class under org.pentaho.reporting.designer.extensions.pentaho.repository.actions
Added the below configuration in ui-overlay.xul under org.pentaho.reporting.designer.extensions.pentaho.repository
<hbox id="main-toolbar">
<button id="toolbar.svncommit" insertafter="toolbar.publish"

Build and deployed the jar under designer lib.

I am not able to see the menu item, something is missing.
Can I get the complete steps to write such action or if you can share me the link (if it is available in the wiki).

Thank you in advance,

04-20-2012, 09:12 PM
You added a button to the toolbar. You might want to add the same action as "menuitem" under the "menupopup" element in the same file.

04-23-2012, 01:03 AM
I want to added MenuItem "Commit to SVN" (below the Publish) and map the menuitem to "Commit to SVN" trigger SVNAction.class

User will click on File--> Commit To SVN and the SVNAction.class with upload the report template into SVN Server.

To achieve this I need to added link in the menu, implement the action and map the action to the menu. I need the steps that I need to follow.

04-23-2012, 07:52 AM
Could anyone provide relevant links/docs if any.

04-23-2012, 08:07 AM
Have you actually looked at the xul-file you edited? Have you seen the menu-item tags?

04-23-2012, 08:10 AM
Yes, I see the <menu-item/> tag. I am very new to pentaho so it would be great if you could guide me with complete details (or link) how to go about it.

04-23-2012, 10:36 AM
I assume you are looking at


The file in all its glory is:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<menupopup id="file-popup">
<menuitem id="file.publish.solution" insertafter="file.save-as"
<menuitem id="file.open.solution" insertafter="file.open"

<hbox id="main-toolbar">
<button id="toolbar.publish" insertafter="toolbar.save"



When you see the "pen:action" references, you will immediately recognize them as classnames. If you then look at these classes in your IDE, you will see that they are Action implementations. So implement your own action and then create a new entry next to the already existing "menuitem" entries and make its "pen:action" attribute be your class name of the new action.

On how to implement actions: (a) Look at the existing source of the load and save actions - they are probably extremely close to what you want to do already - and (b) if you do not know how to implement actions in the first place: Grab a Java-Swing book or read http://download.oracle.com/javase/tutorial/uiswing/misc/action.html