[
http://jira.jboss.com/jira/browse/JBRULES-577?page=comments#action_12348236 ]
Mark Proctor commented on JBRULES-577:
--------------------------------------
If its not time constant then then it belongs in an eval - we won't be changing that.
We'll look into an 'in' operator, we had plans to use an 'in' operator
with a static list of values, maybe we can extend that.
Please add "contained by" syntax for constraints
------------------------------------------------
Key: JBRULES-577
URL:
http://jira.jboss.com/jira/browse/JBRULES-577
Project: JBoss Rules
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Components: Drl Parser/Builder
Reporter: Dirk Bergstrom
Assigned To: Edson Tirelli
I'd like to be able to write a constraint to determine if a field's value is a
member of some collection. This is the inverse of the "contains" keyword. The
proposed syntax is:
[bindingVar :] <fieldName> in <someCollection>
(I'm not picky about the keyword, other possibilities are "containedBy" or
"memberOf", but "in" is a single word)
Use case:
I have a container class with a field that exposes a collection of record
numbers. In the working memory, I have a bunch of record objects, and one
container object. I want to write a rule that fires when it encounters a
container that has records matching some criteria:
when
Container( $recordNums : records )
Record( number in $recordNums, otherField == "somevalue" )
then
doStuff();
The current workaround is:
Record( num : number -> ( $recordNums.contains(num) ) )
Which is problematic, as the predicate may not be time-constant.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira