Ben Schiefer created UNOMI-483:
----------------------------------

             Summary: EventTypeRegistry evaluating events based upon event 
condition
                 Key: UNOMI-483
                 URL: https://issues.apache.org/jira/browse/UNOMI-483
             Project: Apache Unomi
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.5.5
            Reporter: Ben Schiefer


The EventTypeRegistry that was recently added  (awesome feature, by the way) 
([https://github.com/apache/unomi/pull/236/files)] is currently keyed based on 
the eventType string on the event coming in.  Unfortunately, this will not work 
with how we are using Unomi, thus preventing us from any future upgrades.

 

In our design, we use eventType as more of a "verb", so you can have the same 
eventType string applying to multiple different sets of valid properties.
Example:
```
eventType      target.itemType       source.itemType
view               page                          site
view               survey                        page
view               surveyQuestion         survey
submit           form                           page
submit           survey                        page
submit           surveyQuestion         survey
```



I'm hoping that the EventTypeRegistry can be updated to allow for condition 
based event matching, not just validation based on the eventType string 
(perhaps falling back to the eventType mapping if no condition is set?).

Here is a contrived example of what I mean 
/META-INF/cxs/events/submitSurvey.json
```
{
    "type": "submitSurvey",
    "condition": {
        "type": "booleanCondition",
        "parameterValues": {
            "operator": "and",
            "subConditions": [
                {
                    "type": "eventTypeCondition",
                    "parameterValues": {
                        "eventTypeId": "submit"
                    }
                },
                {
                    "type": "eventPropertyCondition",
                    "parameterValues": {
                        "propertyName": "target.itemType",
                        "propertyValue": "survey",
                        "comparisonOperator": "equals"
                    }
                }
            ]
        }
    },
    "propertyTypes": [
        {
            "itemId": "target",
            "type": "set",
            "childPropertyTypes": [
                {
                    "itemId": "itemId",
                    "type": "string"
                },
                {
                    "itemId": "properties",
                    "type": "set"
                }
            ]
        }
    ]
}
```

 

Thoughts?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to