Java Methods
The ability to call Java methods has been added to make report authoring easier. Because Java methods are always invoked in a method server, to ensure security only those Java methods specified in a configuration file can be invoked in a report. By default, this configuration file is:
<Windchill>\conf\queryBuilderMethods.xml
where <Windchill> is the installed location of your Windchill solution.
|
The default configuration file can be overridden by setting the wt.query.qml.allowedMethodsXMLFile property in wt.properties.
|
The following attributes are used in specifying the Java methods in the configuration file:
• class—The package and class containing the method. This attribute is required.
• name—The name of the method. This attribute is required.
• static—Indicates whether the method is a static method. This attribute is optional, and if not specified the value is assumed to be false.
The format for specifying a Java method in the configuration file is shown in the following example:
<methods>
<method class="java.lang.Object" name="toString"/>
<method class="java.lang.Object" name="getClass"/>
<method class="example.HelloWorld" name="example" static="true"/>
</methods>
To add a new Java method, add a new method element to the configuration file, as shown in the example. Java methods can be removed from the configuration file, removing them from availability for use in authoring reports, by deleting its method element.
|
While authoring a Java method in a class, ensure that the argument's data type is Wrapper classes instead of Primitive Datatypes as the primitive data types does not store null value. For example, use Boolean instead of boolean, and Integer or Number instead of int.
|
After adding a new Java method, use the
Load Application Data action from the
Query Builder Maintenance Dashboard. This action loads the new Java method and makes it available for use in the
Query Builder. For more information, see
Query Builder Maintenance Dashboard.