Mapping values to context keys
Within the <requestMapperDefinition> tag, map values to context keys by using the <selection> tag. This mapping provides the changes in the monitoring information.
If no value is mapped to a key after the evaluation of the request mapper configuration, ITCAM uses the original value extracted from the request.
- <matchCriteria>
- An expression that must return a Boolean value. The mapping that is defined within this tag is
only used if this expression returns
true
. - <mapTo>
- Defines a key and the value to map to it. Within this tag, a <key> tag contains the key, and a <value> tag contains the value.
- <selection>
- You can nest <selection> tags, placing one within another.
If <selection> tags are nested, then the nested mapping is only used if both
the outer and the nested <matchCriteria> expressions return true
.
You
can use multiple <selection> tags within a <requestMapperDefinition> tag or within
another <selection> tag. If the same key is mapped several times in several <selection>
tags on the same nesting level (that is, within the same parent tag), then the first mapping for
which the <matchCriteria> expression returned true
is
used.
Do not map the same key both in the outer and nested <selection> tags.
Typically, use the <matchCriteria> value of true
as an
"else" value for the last selection tag on a nesting level. If you want to map different
values in different cases, use several <selection> tags within this outer tag; each of them
can contain the criteria and values for a particular case. The last tag, with a value of
true
, covers the case when the available data meets none of the
criteria.
Examples
<selection>
<matchCriteria>true</matchCriteria>
<mapTo>
<key>Result</key>
<value>$s1</value>
</mapTo>
</selection>
In
this mapping configuration, Result
is set to the value of the symbol
$s1
.<matchCriteria>true</matchCriteria>
<selection>
<matchCriteria>$b1</matchCriteria>
<mapTo>
<key>Result</key>
<value>1</value>
</mapTo>
</selection>
<selection>
<matchCriteria>true</matchCriteria>
<mapTo>
<key>Result</key>
<value>2</value>
</mapTo>
</selection>
In
this mapping configuration, the symbol $b1
must return a Boolean value.
Result
is set to 1 if $b1
returns true
, and to 2
if $b1
returns false
. If $b1
returns
true
, request mapper uses the mapping for Result
in the first
<selection> tag; the mapping for the same key in the second tag is not used.