resolveEventContext

fun resolveEventContext(config: JSONObject, contextList: List<String>, contextMap: Map<String, String>): List<String>

Resolves which event context values a rule configuration points at.

The configuration is the rule itself when matching words, or the rule's 'values' object when writing a profile property. Both use the same keys:

  • 'contextkey' set: the value of that top level key of an object context. Takes precedence over 'contextposition'.

  • 'contextposition' >= 1: that 1-based slot of a list context (1 is the first item).

  • neither: all context values, from both the list and the object context.

Both keys are read leniently: the listener sends 'contextposition' as a JSON number or a string, and either key can be absent.

Return

The resolved context values, empty when the requested key or position is not present.

Parameters

config

The rule or the rule's 'values' object.

contextList

The list context of the event.

contextMap

The object context of the event.