TriggerBuilder equivalents for rules types in JSR223 scripting (groovy)

I’m playing with JSR223 scripting, specifically converting dsl rule types into their groovy equivalents.

I can see how many of them work from things like

TriggerBuilder.create()
        .withId("aTimerTrigger")
        .withTypeUID("timer.GenericCronTrigger")
        .withConfiguration(new Configuration([cronExpression: "0 * * * * ?"]))
        .build()
    ])

I’m not sure what is supposed to be done for other rule “when” clauses; for example, rules DSL allows

 Member of GroupABC received command "waa"

I’m unsure which TypeUID and Configuration parameters that’s supposed to map to?

There’s also capabilities like

Thing thingID received update
Thing thingId changed from "X" to "Y"

Which I can’t see how are intended to be done (possibly some type of core.GenericEventTrigger ?)

Any hints (or source) I can look at ?

You can look at the Jython helper library. It’s JSR223 too and theses are all Java so it should be pretty much the same with only minor syntax differences.

1 Like

Excellent - that’s precisely what I needed (and I wasn’t aware of these helper libraries project so that’s ++good).