Posted by larryjava
on July 30, 2012 at 8:03 AM PDT
During our 10 years of using Java at Amway Corp., some of our solutions
required us to think a little "outside of the box".
Our application had a reporting requirement.
It had to generate reports from the application's various batch processes as they were running.
These batch processes performed transaction processing, data purging and data exporting functions.
The reports would not be used by the business users, they would be used by our application administrators.
The batch processes worked with large amounts of data and would run at a variety of times.
We had to find a way to generate the reports while the batch processes were running.
The report pages contained plain text. The report page format requirements were plain and simple.
Show the text data on a report page in a list or tabular format.
The report pages had to be stored for later viewing. We wanted a pure Java solution for this.
We came up with the idea of using HTML to format reports as we were learning about JSP's.
At first, we thought HTML was for web page development only. It could not be part of our reporting solution.
But then we said, why not?
HTML commands could be embedded in a text page created by our Java application.
The text pages could then be saved as files on a file server.
The app would also create an index page to store the URL link to each report page.
The URL link to the index page itself would be stored in the database.
The links would be accessed by the app via a web page that we developed for this purpose.
This is the capability we built to create our reports.
The batch process did the following:
- Create a file containing the report page
- Add the report header data to the report file
- Create a file containing the index page
- Add the index header data to the index file
- During execution of the batch process; add detail text data to the report file
- If the report page is "full", add report page URL link to index page file;
then create a report file for the next page
- When the batch process is completed; close report page file, close index page file,
save index page URL link in database
The web page did the following:
- Search for available index page URL links stored in database
- Display index page URL links on web page, the user sees a list of report links
- Administrator user will select an index page URL link to view
- Display index page contents on web page; the user sees a list of page numbers
- Adminstrator user will select a report page number to view
- Display report page contents on web page
A sample index page looks like this -
A sample report page looks like this -
||30-Jul-2012 08:09 Page 24
Our idea of using HTML for report generation was simple and easy.
It worked well for our reports regardless of the page count.
It was our all-Java solution for simple report generation.
10 years later, these reports are still being created and used by our application administrators.