The SIS automatically converts a literal constant value assigned or compared to a enumerated datatype into its enumerated object equivalent.
Consider the following example:
<equal
a="${initial-dp.arg.event-type-bcsm}"
b="analyzedInformation"/>
In this case, the SIS knows that the type of the ${initial-dp.arg.event-type-bcsm}
variable is the named integer type CCEventTypeBCSM
— so it tries to find the enumerated value of that type, with the name analyzedInformation
, for the comparison.
When the SIS can’t determine the type
In some cases, however, you may want to assign an enumerated value constant to a variable that the SIS cannot determine a concrete type for. For example, the variable may be defined as a generic NamedInteger
type, or the variable may be a user-defined variable. In these situations, the SIS has no way of knowing how to convert a string or numerical constant value for assignment into anything more useful. Consider the example below:
<assign
toVariable="${user.event-type-bcsm}"
value="analyzedInformation"/>
Here, the SIS will assign the literal string value “analyzedInformation” to the user variable, rather than the intended enumerated value with that name.
To alleviate this problem, the SIS provides an <enum> object constructor element for ENUMERATED variable types. This element requires the fully-qualified class name of the enumerated datatype and the enumerated value to be specified. The constructor returns the indicated enumerated value. For example:
|
<assign toVariable="${user.event-type-bcsm}">
<enum
class="com.opencloud.slee.resources.cgin.callcontrol.CCEventTypeBCSM"
value="analyzedInformation"/>
</assign>
If the class is unknown by the SIS, or is not an enumerated type, or the specified value is not a known value for the enumerated type, the constructor will fail. |
Creating enumerated values from a constant value
Note that, as enumerated values are just named integer values, it’s also possible to create enumerated values from a constant numerical value rather than a named value. For example, the following produces the same result as the preceding example, since analyzedInformation
is the named value for the integer 3
within this datatype:
<assign toVariable="${user.event-type-bcsm}>
<enum
class="com.opencloud.slee.resources.cgin.callcontrol.CCEventTypeBCSM"
value="3"/>
</assign>