<div>(1) Theres nothing stopping you using a singleton to hold "state", so this provides what you want:-</div>
<div> </div>
<div>rule "1"</div>
<div>when</div>
<div>$o : AnObject( someField == someCriteria )</div>
<div>then</div>
<div>boolean someFlag = true;</div>
<div>insert(new State( someFlag ) );</div>
<div>end</div>
<div> </div>
<div>rule "2"</div>
<div>when</div>
<div>State (someFlag == true )</div>
<div>$o : AnotherObject ( )</div>
<div>then</div>
<div>//something else</div>
<div>end</div>
<div><br>You could also have the first check activate another AgendaGroup, for example:-</div>
<div> </div>
<div>rule "1"</div>
<div>when</div>
<div>$o : AnObject( someField == someCriteria )</div>
<div>then</div>
<div>drools.setFocus("SomeOtherGroup");</div>
<div>end</div>
<div> </div>
<div>rule "2"</div>
<div>agenda-group SomeOtherGroup</div>
<div>when</div>
<div>$o : AnotherObject ( )</div>
<div>then</div>
<div>
<div>//something else</div>
<div>end</div><br>(2) I believe the ObjectTypeNode filters based on "Class.isInstance()" and therefore you should be able to code rules based upon the sub-class and insert super-classes.</div>
<div> </div>
<div>With kind regards,</div>
<div> </div>
<div>Mike</div>
<div> </div>
<div> </div>
<div><span class="gmail_quote">On 06/10/2007, <b class="gmail_sendername">Sikkandar Nawabjan</b> <<a href="mailto:Sikkandar.Nawabjan@ustri.com">Sikkandar.Nawabjan@ustri.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi,<br>I have couple of questions<br><br>1) I want to validate a Object and based upon certain condition set the flag and that flag available in my working memory context so that all the rules will execute based on the value of this flag. Is there any way to set the Global variable in working memory environment and use it in predicate logic.
<br>I beleive passing Global variable using setGLobal() is possible but we can't use it in predicate logic.<br><br>2) my second quetion is i have 2 classes say<br><br>Public class B extends Class A{<br><br>private boolean flag;
<br><br><br>}<br><br><br>am validating my rule using of type B.<br>But i want to assert object of class A. in normal java we do downcasting B b = (B)obj;<br>if i don't do that will downcast will happen at the working memory side automatically??????????
<br><br><br>Basha<br><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">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br><br></blockquote></div><br>