To generate a static wrapper class, proceed as follows:
Configure the Ant task file as described in Configuring the Ant Task File.
Execute the Ant task file as described in Executing the Ant Task File.
For an example of how to use a static and dynamic wrapper, see Example of Using Static and Dynamic Wrappers.
When a new OpenL Tablets project is created, it already contains an Ant task file GenerateJavaWrapper.build.xml
located in the build
folder. When the file is executed, it automatically creates wrapper
Java classes for specified Excel files. The Ant task file must be
adjusted to match contents of the specific
project.
For each Excel file, an individual <openlgen>
section must be added between the <target>
and </target>
tags.
Each <openlgen>
section has a number of parameters that must be adjusted. The following
table describes
<openlgen>
section parameters:
Parameters in the <openlgen> section |
|
---|---|
Parameter |
Description |
|
OpenL configuration to be used. For OpenL Tablets, the following value must always be used:
|
|
Location of user defined resources relative to the current OpenL Tablets project. |
|
Reference to the Excel or Word file for which a wrapper class must be generated. |
|
Full name of the wrapper class to be generated. OpenL Web Studio recognizes modules in projects by wrapper classes and uses their names in the user interface. If there are multiple wrappers with identical names, only one of them is recognized as a module in OpenL Web Studio. |
|
End user oriented title of the file that appears in OpenL Web Studio. |
|
Folder where the generated wrapper class must be placed. |
The following is an example of the GenerateJavaWrapper.build.xml
file:
<project name="GenJavaWrapper" default="generate" basedir="../">
<taskdef name="openlgen" classname="org.openl.conf.ant.JavaWrapperAntTask"/>
<target name="generate">
<echo message="Generating wrapper classes..."/>
<openlgen openlName="org.openl.xls" userHome="."
srcFile="rules/Rules.xls"
targetClass="com.exigen.claims.RulesWrapper"
displayName="Rule table wrapper"
targetSrcDir="gen"
>
</openlgen>
<openlgen openlName="org.openl.xls" userHome="."
srcFile="rules/Data.xls"
targetClass=" com.exigen.claims.DataWrapper"
displayName="Data table wrapper"
targetSrcDir="gen"
>
</openlgen>
</target>
</project>
To execute the Ant task file and generate wrappers, proceed as follows:
In Eclipse, refresh the project.
Execute the Ant task XML file as an Ant build.
Refresh the project again so that wrapper classes are displayed in Eclipse.
Once wrappers are generated, the corresponding Excel or Word files can be used in the solution.