I just wrote my first python rule using the jsr223 engine, and found it a lot easier than using xtend.
But how can I access Group items, and in particular iterate through a list of all members? In xtend that would look like this:
group.allMembers.filter.forEach[item|
do something
]
How can this be done using python in the jsr223 framework?
I’m not at my development computer right now to verify the exact syntax, but you should be able to do something like…
for item in group.getAllMembers():
# do something
If you need to filter the items, you could do something like…
for item in filter(myfilter, group.getAllMembers()):
# do something
Where myfilter could be a Python function or lambda taking an item as an argument. You could also use list comprehensions to filter or transform the group members.