Oracle Waveset 8.1.1 Deployment Reference

Example Scenario

The following example illustrates a type of expression optimization.

If you want to query a database for information that is not stored in Waveset or accessible as a resource account attribute, follow these general steps:

ProcedureTo Perform Optimizing Expressions

  1. Write a Java class that performs the database access.

  2. Define a form field that uses a default expression to call the Java class.

  3. Reference the hidden variable.

Using a Java Class to Obtain Field Data

You will need to write a Java class that has methods that can be called to retrieve information. The example in the following section, Defining a Hidden Form Field, uses the getJobGrade method, which is a custom method. You should locate this custom class in the idm\WEB-INF\classes\com\waveset\custom directory structure. (If these directories do not exist on your system, you must create them.)

Follow these guidelines when writing this class:

Defining a Hidden Form Field

First, define a hidden form field that uses a default expression to call the Java class by not including any Display class in the field definition:


<Field name=’jobGrade’>
   <Default>
      <invoke name=’getJobGrade’ class=’com.waveset.custom.DatabaseAccessor’>
         <ref>waveset.accountId</ref>
      </invoke>
   </Default>
</Field>
     </Derivation>

Default expressions are evaluated only if the view does not contain a value for the attribute jobGrade. Once the default expression has been run, the result is stored in jobGrade, and the expression is not run again.

ProcedureTo Define a Hidden Form Field

  1. Select Hidden from the Display Class menu.

  2. Click OK.

    The Hidden display class corresponds to the <input type=hidden’/> HTML component. This component supports only single-valued data types because there is no way to reliably serialize and deserialize multi-valued data types.

    If you have a List that you want to render it as a string, you must explicitly convert it to a String, as shown in the following example:


    <Field name=’testHiddenFieldList’ >
       <Display class=’Hidden’/ >
       <Derivation>
         <invoke name=’toString’>
           <List>
             <String>aaaa</String> <String>bbbb</String>
           </List>
         </invoke>
       </Derivation>
    </Field>

Referencing the Hidden Attribute

Once you have defined a hidden attribute, you can reference it in other expressions, such as:

<Field name=’secureKey’>
   <Disable><lt><ref>jobGrade</ref><i>10</i></lt></Disable>
     ...
</Field>

You can use XPRESS defvar variables to hold the results of a computation, but the results are typically not as efficient as using a hidden form field.

Note about Optimizing Variables Beyond a Single Iteration

XPRESS variables typically persist for only a single iteration over the form fields. As a result, you can use a variable within an Expansion phase but not on a subsequent Derivation phase. If you need a computed value to remain relevant beyond one field iteration, use a hidden form field instead. Hidden field values are stored in the view and will persist until the editing session is either canceled or saved.