Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Script expressions can use a variety of scripting languages. Currently supported languages are:

Script Expression Structure

All the script expressions have the same internal structure no matter where and how they are used. The structure is illustrated in the following code snippet.

<expression>
    <script>
        <language>http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy</language>
        <code>
            'Mr. ' + user.getFamilyName();
        </code>
    </script>
</expression>

Meaning of individual fields is as follows:

Field

Description

language

Language URL. Specifies the language in which the expression is written.

returnType

TODO

relativityMode

TODO

code

Expression code. This is usually a string, but it also may be an XML. Please note that the code is embedded in the XML therefore proper XML escaping is required

Variables

The XPath expressions used in midPoint are most frequently using variables. For example, the following XPath expression will evaluate to the content of the fullName property of a user (using c as a namespace prefix):

<code>
   $c:user/c:fullName
</code>

The same expression in Groovy and JavaScript looks like this:

<code>
    user.getFullName();
</code>

See Expression page for more generic information about the use of variables in expressions.

Absolute and Relative Script Expressions

Future

The expressions are designed to be extensible and the expression language is not fixed. New expression languages may come in the future if there is a demand for them.

See Also

  • No labels