<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hello,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>I am using JBoss Rules to validate entities before storing them in the database. I therefore need a way to inform the calling code that the entity which was asserted failed verification. The only way I have been able to find that works is to assert an exception from within the rule file. For example:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>rule "user is 'miked'"</DIV><DIV>  when</DIV><DIV>    identity : Identity( username == "miked" )</DIV><DIV>  then</DIV><DIV>    assertLogical(new IllegalStateException("Entity failed verification."));</DIV><DIV>end</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Then in the Java that fires the rule, I have:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>workingMemory.fireAllRules();</DIV><DIV>for(Iterator i = workingMemory.getObjects(Exception.class).iterator(); i.hasNext(); ) {</DIV><DIV>    System.out.println("Exception: "+i.next());</DIV><DIV>}</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Which seems to be working OK. But I wanted to see if maybe there is a better way to accomplish what I need.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Thanks for you help.</DIV><DIV>Mike</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>--</DIV><DIV>*********************************</DIV><DIV>Mike Dougherty</DIV><DIV><A href="mailto:mjdougherty@gmail.com">mjdougherty@gmail.com</A></DIV><DIV>858.232.3635</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><A href="http://www.google.com/talk/">http://www.google.com/talk/</A></DIV><DIV>*********************************</DIV><DIV><BR class="khtml-block-placeholder"></DIV></SPAN></SPAN></SPAN></SPAN><BR class="Apple-interchange-newline"></SPAN></SPAN></SPAN> </DIV><BR></DIV></BODY></HTML>