The answer to your question "Would this work?" depends on what
you think that "work" means.
(1) "Work" means that the rule fires. If there are these two facts,
one with type == "TYPE_1" and the other with another value (such as
"TYPE_2", or any other value except "TYPE_1") then the answer is
"yes".
(2) "Work" means that the rule should *only* fire if there is an
*older* ("current") fact with any value except "TYPE_1" and a *newer*
fact with type =="TYPE_1", then the answer is "no": the engine has no
notion of "incoming" or "current".
(3) "Work" means anything else: I don't know. :)
-W
On 25/05/2012, Ben Cuthbert <[email protected]> wrote:
> All
>
> If I have an object say
>
> class TestObject {
> private String type;
> private String name;
> }
>
> And I want to match opposite types so I fire in the following
>
> insert(new TestObject("TYPE_1", "This is our type 1 object");
> insert(new TestObject("TYPE_2", "This is our type 1 object");
>
> So I want to say only match again opposite types
>
> would this work?
>
> rule "#999 Match"
> dialect "mvel"
> when
> $incoming : TestObject($type: type)
> $current : TestObject( type != $type)
> then
> insert(new String("LOGGING: incoming:" + $incoming.getType() + "
> current:" + $current.getType() ));
> end
>
>
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users