Jump to content

jasper version control


linvicch

Recommended Posts

Hi,  I am atm trying to think of a way to add some sort of versioning to the report. My current plan is to add a trigger so that on update of a report, add a version number, a date, a copy of the old jrxml(maybe) onto a new table.

The only problem is what is the best way to pull out that version number onto a report so that every report that gets printed will show the version of the report.

The only way I can currently think of doing this is to add some java code (.jar) that will retrieve the version from the database so in a textfield, have a expression that goes  "new my.com.version.get("test.jrxml")" 

doesn't seem like a clean and neat solution. I would like to avoid touching the base JS code due to further possible upgrades in the future

Kindly please help thanks :)

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Does anyone know how to retrieve  the name of the report?

I figure if I am able to retrieve the name/id  of the report, I can use a scriptlet to extract the version of the report based on the name

How does everyone handle their versioning?  Versioning have always play an imperative role in any project whether it be developing, report writing, documentation. Doesn't anyone care which version of the report their users are reading?

Link to comment
Share on other sites

The existing database structure has columns which can be part of a versioning solution:

mysql> desc jiresource;
+----------------+-------------
| Field          | Type
+----------------+-------------
| id             | bigint(20)
| version        | int(11)
| name           | varchar(100)
| parent_folder  | bigint(20)
| childrenFolder | bigint(20)
| label          | varchar(100)
| description    | varchar(250)
| creation_date  | datetime
| update_date    | datetime
+----------------+-------------
9 rows in set (0.00 sec)

 

So, there is a version column which is currently not used. In addition, there is the creation_date.

 

But, in general, users are not tracking individual report versions. There is one current report in the system that can be edited or executed.

 

You would need to extend the existing code. Probably an API to look at would be EngineService.java (and EngineServiceImpl.java set of related classes).  Also, please submit this as an enhancement request (I will check and see if this has been requested already). There is a Roadmap on JasperServer project area (in the Wiki) - this will give an indication of what's coming next based in part on user voting for specific features.

 

Link to comment
Share on other sites

Thank you very much for taking time to reply. I have read that the version number in that table is used for optimistic locking but I shall give that a try.  I have been delving into the source code recently to hunt for reusable code to retrieve ID or report name/URI to retrieve the version number using scriptlet.

Glad to know I am on the right track.

Once again thank you

Link to comment
Share on other sites

Sorry maybe missing the point but why don't you use a version control system to store changes to the reports rather than jasperserver?

We simply store the jrxml files in subversion, check out and amend in iReport, commit changes to subversion which stores all the revision history. We then upload the latest revision to jasperserver (as the previous post mentions jasperserver simply stores one copy of the report which is the latest one).

As part of the amend process to the jrxml file we manually update a text field on the report to say what revision number the report is. Admittedly this probably isn't foolproof but don't really see why you're trying to create versioning in jasperserver when there are tools that will do it for you.

Link to comment
Share on other sites

That was our initial plan but that relies too much on the user to do the right thing. eg, forgetting to check in to get new version,

putting in the wrong version number etc etc.

So far creating a trigger to add a version++ and timestamp then using a scriplet to retrieve the version number works but the only problem is it still relies on the user to put in a uri to retrieve the version number

eg. Version.getVersion("reports/test")

if only there is a way to get the name or id of the report being ran without modifying the source code.

We can't touch the source code for JS because of the solution deliverable design. we won't be getting our jasper server untill (go-live date) - 1 month. its quite a complicate issue and its causing us alot of grieve :(

 

 

 

 

Link to comment
Share on other sites

Ok sounds complicated.

Not sure if this helps or will meet your needs but may be worth having a look at com.jaspersoft.jasperserver.war.action.reportManager.ResourceRowModel as this seems to hold the info you're after for each report (id,name etc).

Within JasperServer the jsp RepositoryExplorerAjaxTable.jsp uses things like ${resource.id} to render out the id for a hyperlink etc. Maybe able to use this in some way??

Admittedly I've changed the source code but I use it to render out a link to a help guide for each report we run using the resource.id as a unique identifier to the individual help guide.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...