Methods for dynamically calculating values within forms include:
Generating field values
Including rules in forms
Including XPRESS statements in a form
In some forms, you might want to first display a set of abstract derived fields to the user, then generate a different set of concrete resource account attribute values when the form is submitted. This is known as form expansion. Expanded fields are often used in conjunction with derived fields.
In forms, you typically call a rule to calculate the allowedValues display property or within a <Disable> expression to control field visibility. Within forms, rules could be the most efficient mechanism for storage and reuse of:
a list of corporate departments
a list of office buildings
For a comprehensive discussion of rules, see Chapter 4, Working with Rules.
The XPRESS language is an XML-based expression and scripting language. Statements written in this language, called expressions, are used throughout Identity Manager to add data transformation capabilities to forms and to incorporate state transition logic within Identity Manager objects such as Workflow and forms.
For a comprehensive discussion of XPRESS features, see Chapter 5, XPRESS Language
Expressions are used primarily for the following Identity Manager tasks:
Customizing the end-user and administrator forms. Forms use XPRESS to control the visibility of fields and to transform the data to be displayed and saved.
Defining flow of control in Workflow. Workflow uses XPRESS to define transition conditions, which determine the order in which steps in the workflow process are performed.
The expressions contained in these elements can be used throughout Identity Manager.
In the following example, the <add> element represents a call to the XPRESS function named add.
<add> <ref>counter</ref> <i>10</i> </add>
This function is passed two arguments:
first argument– value is determined by calling a function named ref. The argument to the ref function is a literal string that is assumed to be the name of a variable. The value returned by the ref function is the current value of the variable counter.
second argument -- value is determined by calling a function named i. The argument to the i function is a literal string that is an integer. The value that the i function returns is the integer 10.
The value returned by the add function will then be the result of adding the integer 10 to the current value of the variable counter. Every function call returns a value for the next operation to use. For example, if the ref call returns the value of the counter, then the <i> call returns the integer 10, then the <add> call returns the addition of the two calls.
The following example shows the use of XPRESS logic embedded within an Identity Manager form. XPRESS is used to invoke one of the FormUtil Java methods that will produce the relevant role-related choices for display in the browser. Note that the expression is surrounded by the <expression> tag.
<Field name=’waveset.role’> <Display class=’Select’ action=’true’> <Property name=’title’ value=’Role’/> <Property name=’nullLabel’ value=’None’/> <Property name=’allowedValues’> <expression> <invoke class=’com.waveset.ui.FormUtil’ name=’getRoles’> <ref>:display.session</ref> <ref>waveset.original.role</ref> </invoke> </expression> </Property> </Display> </Field>