The Spring Expression Language (“SpEL” for short) is a powerful expression language that supports querying and manipulating an object graph at runtime.
In Favendo’s context it can be used in a routine definition to condition its triggering.
For example:
Event: tags enters a zone
Routine: Send a notification if the condition “assignedAssetDto!=null” (tag is assigned to an asset) is true
Following some examples on how to use it.
Condition | SpEL value | Comment |
---|---|---|
If tag is assigned to an asset | assignedAssetDto!=null | |
If a specific custom attribute of type “ATTRIBUTE_WITH_BOOLEAN” is true | assignedAssetDto.customAttributes[1].booleanValue | The custom attribute order needs to be known |
If a custom attribute of type “ATTRIBUTE_WITH_MULTIPLE_CHOICE” or “ATTRIBUTE_WITH_SINGLE_CHOICE” has value XX | assignedAssetDto.customAttributes[2].valueKey==XX | for multiple choice or single choice, it is recommander to use the value key |
If a custom attribute of type “ATTRIBUTE_WITH_TEXT” has value XX | ‘customAttributeWithText-value’.equals(assignedAssetDto.customAttributes[0].textValue) | for string use equals for comparison |
If current time is between XX and XX | T(java.time.LocalTime).now().isAfter(T(java.time.LocalTime).of( 00 , 00 , 00)) && T(java.time.LocalTime).now().isBefore(T(java.time.LocalTime).of( 23 , 59 , 59)) | the event time stamp can also be used |