This feature is available in midPoint 3.6 or later.
See Constants page for motivation and general introduction to the concept of constants.
The constants are defined in the midPoint configuration file (config.xml) in midPoint home directory:
Use of Constants
Constants are usually used in expressions. There is a special
const expression evaluator for easy use of the constants. For example a constant defined above may be easily used in the outbound mapping:
In that case every time the expression is evaluated it will produce a value defined in the config.xml file. In this case the value will be "Example, Inc." and that is what will be stored in the resource attribute. The same constant may be used at many places in the system. Which makes changing the value quite easy.
Constants are especially useful in resource configuration. However, prior to midPoint 3.6 it was not possible to use expressions in resource configuration. Since midPoint 3.6 this is perfectly possible. Therefore the constants can be easily used in resource configuration:
The constants are often used to compute a value, where the constant is just a part of the resulting value. In that case the
const expression evaluator cannot be used. Therefore there is a
getConst() library function that can be used in scripting expressions:
Limitations and Future Extensions
There are few known limitations to this functionality in midPoint 3.6:
- Constants are loaded only once at system startup. Currently there is no way how to refresh the values when the constants change except for system restart.
- There is no support for these features in resource wizard. Resource wizard does not support expressions in resource configuration properties and it does not support
Future midPoint versions will probably introduce several alternative methods to specify constant values. One such method may be specification of constant values in system configuration object. If you are interested in this extension or you are affected by the current limitations then please consider a subscription.