Figure 6-1A new Java Project is selected in the Eclipse IDE
Figure 6-2The Java Project type is selected
For compatibility with the FileNet jar files, we select the same JRE Library we used for the Java in Chapter 2.
Figure 6-3The JRE is selected for compatibility with the FileNet API jar files
Figure 6-4The name is set as Audit_Report
A pop-up window asks if we want to use the Eclipse IDE Java perspective, which automatically sets a number of window pane views and a tree browser pane on the left of the window to allow the program classes to be split into a logical package structure for the Java project.
Figure 6-5The Java perspective is selected
Creating the com.asb.ce.utils Java Package
Figure 6-6The New Package option is selected for the Audit Report program
In Figure 6-6, we select a new class Package to add supporting Java code for the main Audit Report program.
Figure 6-7The Package name is entered as com.asb.ce.utils
Underneath the com.asb.ce.utils package (which is actually an Eclipse nested folder structure), we now add a Java class, which will hold the Java code we need for some utility class methods.
Creating the AuditReportConfig Java Class
Figure 6-8The right-clicked package gives the New ➤ Class menu
We create an AUDITReportConfig class for Java code which will read in the parameters we require to drive the Audit Report program. These are held in a config.xml file which we structure to make entry of the variables easier and to allow the right values to be read for each of the program variables (and to avoid hard-coding for maximum flexibility).
//ASB … 11-08-2022 – Make platform independent
String OS = System.getProperty(“os.name”).toLowerCase();
String file;
if (OS.indexOf(“win”) >= 0) {
file = System.getProperty(“user.dir”) + “\\config\\config.xml”;
} else { //Set to forward slash
file = System.getProperty(“user.dir”) + “/config/config.xml”;
}
Listing 6-11The section of code to read the config.xml with platform independence
Figure 6-9The AUDITReportConfig class is defined for entry of the code
Leave a Reply