Friday, March 25, 2011

Jasperoo update

I have just completed some fairly significant enhancements to Jasperoo. It's starting to look like a pretty solid addon for Spring Roo. As far as I can tell, your Roo projects can now benefit from the power of Jasper Reports.

What has changed?
  • I've introduced "Detail" reports. These reports provide the contents of all the fields of a specific entity instance, all on one page.
  • I've abandoned the idea of a menu entry for each report. The reports are now accessed through icons on the "List" and "Show" page for each entity that has been added to Roo.
  • I've simplified the process of adding additional report formats. Previously, you had to choose which formats you wanted when you called "setup". With the addition of the "extend" method, you can now add support for other formats after setup.
  • I have spent a fair bit of time documenting jasperoo. Please check out the jasperoo project site at, and click on API and How-To from the left-side navigation.
Many thanks for the feedback already received, I look forward to hearing more.

Here are some screen shots to whet your appetite.
A "show" screen with the report icons highlighted.

A "Detail" report

A "list" screen with the report icons highlighted.

A "List" report.
The "extend" command in use.

Friday, March 18, 2011

#JasperReports + #SpringRoo = #Jasperoo

For Immediate Release

DigitalFace has released the jasperoo code to the community under GPL3.

What? You say you've never heard of it before? Well, that's not too surprising, I only dusted off the last of the critical functionality last night. ;o)

There are still features missing, and a few little bugs, but I didn't want to work on it any longer without checking it into source control, and since I planned to make this a open source project, I figured that now is the time for its release.

What is jasperoo, and why should I care?
If you don't use Spring Roo, then you probably won't care... just carry on with your life.

If you have started using Spring Roo (or if you've been reading my posts lately), then you already know that it is very powerful for quickly stitching together the components needed for Enterprise Java applications. Jasperoo facilitates the integration of Jasper Reports into your Spring Roo applications.

Let's say that you have created the PetClinic application and would like to have a report that generates a list of Owners. Without jasperoo, you would need to:
  • Add the JasperReports dependencies to your pom.xml;
  • Add the jasperreports-maven-plugin to your pom.xml;
  • Create the ReportController to handle the report requests;
  • Create your jrxml template; and 
  • Wire it all together.
With jasperoo, after it is installed, you just have to call:
  • jasperoo setup
  • jasperoo add --type ~.domain.Owner
Do you want to try it out?
Ok... here we go. I will assume that you have already setup Spring Roo, and familiarized yourself with it. If not, go to the Spring Roo website for instructions.

Step 1 - Create a sample application.
mkdir clinic
cd clinic
    ____  ____  ____
   / __ \/ __ \/ __ \
  / /_/ / / / / / / /
 / _, _/ /_/ / /_/ /
/_/ |_|\____/\____/ 1.1.2.RELEASE [rev fbc33bb]

Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.
roo> script --file clinic.roo
Step 2 - If you already have an older version of jasperoo installed do the following, otherwise, skip to step 3.
roo> addon remove --bundleSymbolicName ca.digitalface.jasperoo
Step 3 - Install the latest version of jasperoo
roo> osgi start --url
Step 4 - Setup jasperoo
roo> jasperoo setup
Step 5 - Generate a report of the Pet Owners
roo> jasperoo add --type ~.domain.Owner
There... that wasn't so hard, was it?

Test your work
Now either exit out of roo, or open another command shell and start-up the Pet Clinic application.
mvn tomcat:run
Open your browser and go to localhost:8080/petclinic/
[click to enlarge]

Create a new Owner
[click to enlarge]

Select the PDF report
[click to enlarge]

Open the report in Adobe Acrobat or some other PDF viewer.
[click to enlarge]

Select the Excel Report
[click to enlarge]

Open the report in MS Excel or Open Office Calc
[click to enlarge]

The reports generated are very utilitarian. However they can be readily edited in iReport.

The same code produces pdf and xls files, and with a small change to the menu file you also get csvhtmlodtxml, and rtf formats.

So, I encourage you to download it and try it out. The project is hosted on Google Code:

I look forward to your feedback.