<br> The rule looks fine, so the problem is somewhere else: <br><br>* Are you properly implementing the equals()/hashcode() methods in the StatusProperty class? or are you checking for the exact same instance (in which case the defaul equals()/hashcode() would work)<br>
<br>* are you adding the properties to the TrainingStatus.properties collection before inserting TrainingStatus into the session? or are you calling update/modify after inserting it?<br><br> Also, not related to the problem at all, but we recommend you to use modify() instead of update() in your rules consequence:<br>
<br>modify( t ) {<br> setNextSection( "section_b" ),<br> setPreviousSection( "section_overview" )<br>}<br>
<br> []s<br> Edson<br>
<br><br><div class="gmail_quote">2010/1/24 Mike Dougherty <span dir="ltr"><<a href="mailto:mjdougherty@gmail.com">mjdougherty@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello all,<br>
<br>
I've been getting more and more into using Drools Expert, but I certainly still have a lot to learn. I have almost a complete rules file ready to go. But I am having an issue with the LHS checking that a collection contains a certain object value. The rule currently looks like this:<br>
<br>
rule "Rule Name"<br>
no-loop true<br>
when<br>
property : StatusProperty( name == "propertyName", value == "valueA" )<br>
t : TrainingStatus( currentSection == "section_a", properties contains property )<br>
then<br>
t.setNextSection( "section_b" );<br>
t.setPreviousSection( "section_overview" );<br>
update( t );<br>
end<br>
<br>
<br>
The TrainingStatus object has the following fields:<br>
<br>
public class TrainingStatus implements Serializable {<br>
private String currentSection;<br>
private String nextSection;<br>
private String previousSection;<br>
private Set<StatusProperty> properties = new TreeSet<StatusProperty>();<br>
}<br>
<br>
And the StatusProperty object has the following:<br>
<br>
public class StatusProperty implements Serializable {<br>
private String name;<br>
private String value;<br>
}<br>
<br>
<br>
I'm inserting a TrainingStatus object that should match this rule. But the resulting object does not have the nextSection and previousSection fields set to the values they should.<br>
<br>
Can anyone advise on how to get this rule working as expected?<br>
<br>
Thanks for your help!<br>
<br>
Mike<br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>