From Command Line To Java EE, Nashorn And Enhydrator - A Hospital Reporting System
Andreas (@Andreas_Brueck), please briefly introduce yourself
I work as a system administrator and developer for a company which runs rehabilitation centers and hospitals, mainly in the region of northern Hesse, Germany. Apart from working for this company, I am also self-employed. I have been using Java as my main language since 2007, before that I had used Delphi and Pascal.
What is the purpose of the "Hospital Reporting System"? Is it a project or product?
The hospital reporting system is a project needed for collecting and analysing required data features for various different processes in order to make these data available to colleagues e.g. controllers etc. This reporting system is part of our Business Intelligence system which I have also developed myself.
How are you using enhydrator? Are you still happy with the decision?
In 2007, I developed components for the first version of our hospital reporting system. The components worked very fast but it was only possible to use JDBC to access data bases as sources. The processing procedure was very tight because the JDBC was a fixed part of the system so that it lacked flexibility. It was thus impossible to use other sources than the mentioned JDBC. My decision to use Enhydrator is based upon the following features:
- Open Source
- Easy extension facility: e.g. I have developed an ExcelFileSink as well as a HTMLFileSink.
- Any sources can be used.
- The data chain can be put together very flexibly
How much data is processed? Are you satisfied with the performance?
Between 1 und 1,000 lines. The query needs most of the processing time. The processing by means of Enhydrator is fast enough so we do not put any focus on optimization measures. Therefore, I have put more emphasis on the legibility and handling.
Which IDE, tools, or libraries are you using?
Most often, I am using IntelliJ, sometimes also NetBeans as IDE. The project is completely based on Maven with common Maven plugins. As libraries for the project I am also using - apart from Enhydrator - Apache POI, FreeMarker, JCifs, Cronutils, and Aeonbits Owner.
You migrated the application from CLI to Java EE. Why Java EE?
The requirements for the new version of the reporting system are the following:
- The wish to be independent from Cron
- Creation and execution of reports via web browser
- Report opening with parameters
- Central monitoring
- Parallel generation of reports
- Scripting (Nashorn) for special reports
Could you briefly describe the architecture of you app? (decisions, layers or patterns)
I am using the Entity Control Boundary pattern to keep the application structure clear, easy to maintain and to unterstand for other developers.
To get notifications of changes in the resource and configuration path, I use the WatcherService of the Java NIO package. The Watcher runs in a thread, executed with concurrent utilities of Java EE 7. When a new or changed file in the resource / configuration path is detected, I use CDI events to inform the components.
To communicate with the „outer world“, most components have a REST endpoint, with different types of responses. The report endpoint e.g. returns HTML, XLSX or JSON, depending on the report‘s configuration. With the integrated scripting engine Nashorn and the „invocable“ feature, it is easy to develop a scripting endpoint.
What about Java EE productivity?
As already mentioned before, Java EE, especially Java EE 7, works in a very productive way: Java EE comes along with a lot of components ready to use with defaults suitable for most of the work requirements, and if not, most configurations can be quickly done by creating annotations. This helps focussing on the business per se without wasting time.
Which server are you using?
I started working with Glassfish, currently I am using Wildfly exclusively.
Can you share any blogs, links or resources?
In my opinion the book Java EE 7 Essentials by Arun Gupta is a very good and compact reference and of course your blog, videos and online courses. Other very suitable solutions and a lot of good suggestions for the Java EE 7 samples can also be found on: https://github.com/javaee-samples/javaee7-samples.