Okay … well, without seeing what's been inserted as an Autopolicy in the first place,
I reckon the best plan is to debug it. It's probably worth changing to something like
this:
when
$autoPolicy : Autopolicy($ruleFlowId: ruleFlowId)
then
logger.debug("Rule flow ID = " + $ruleFlowId);
end
That should show you what value is held in the Autopolicy ruleFlowId property.
If you're comparing using != then the value could be just about anything. It could be
a String with a value other than "test" or "control". It could also be
null or a non-String object. When you use == "test", then you are saying that
the value must be a String with the value "test".
Steve
On 5 Feb 2013, at 17:21, Stephen Masters <stephen.masters(a)me.com> wrote:
Going by the example provided, the code is a constraint on the left
hand side … so it's valid to use == or !=. It's not Java code, it's MVEL and
is automatically converted to use the appropriate .equals("") method on the Java
objects.
You would only need to use .equals("") inside an eval or in Java code on the
RHS.
So the answer is something else … but I haven't worked out what yet. :)
Steve
On 5 Feb 2013, at 17:11, rjr201 <rich.j.riley(a)gmail.com> wrote:
> It may be because in Java you have to compare strings using .equals("");
>
> So in your case it would be:
>
> ruleFlowId.equals("test") == true
>
> It's because Strings are objects, and == tests to see if the String is
> literally the same object as the other String, not just a String with the
> same value. != works because they aren't the same object.
>
> Hope that works,
> Rich.
>
>
>
> --
> View this message in context:
http://drools.46999.n3.nabble.com/Can-get-not-equal-to-work-but-not-equal...
> Sent from the Drools: User forum mailing list archive at
Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users