<div dir="ltr"><div><div>By &quot;list collection&quot; you mean the argument you pass to ksession.execute()? This collection ist a one way ticket, not meant to be changed by the execute method.<br><br></div>I&#39;m not sure about what you did when you tried to &quot;change a value on the SearchState object&quot;. Only code will tell ;-)<br>
<br></div>-W<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 9 April 2013 19:39, dfsmith <span dir="ltr">&lt;<a href="mailto:dfsmith@llbean.com" target="_blank">dfsmith@llbean.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I am new to Drools and Guvnor, so I am likely overlooking something simple.<br>
I am prototyping a proof of concept for integrating Drools into SOLR and<br>
using Guvnor for business rule management.<br>
<br>
I have a Guvnor generated rule that looks like this:<br>
<br>
rule &quot;t1&quot;<br>
    dialect &quot;mvel&quot;<br>
    when<br>
        SearchState( searchTerms == &quot;monitor&quot; )<br>
    then<br>
        SearchActions fact0 = new SearchActions();<br>
        fact0.setUrlRedirect( &quot;junk&quot; );<br>
        insert( fact0 );<br>
        System.out.println(&quot;Created junk!!!&quot;);<br>
end<br>
<br>
In a custom SOLR search component, the Drools POC integration code is as<br>
follows:<br>
<br>
try {<br>
<br>
        if (rb.stage == ResponseBuilder.STAGE_START) {<br>
<br>
                // load package<br>
                kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();<br>
<br>
                kbuilder.add( ResourceFactory.newFileResource(new<br>
File(&quot;c:\\data\\guvnor\\searchLatest.pkg&quot;)), ResourceType.PKG);<br>
<br>
                // create the knowledge base<br>
                kbase = KnowledgeBaseFactory.newKnowledgeBase();<br>
<br>
                // add the package to the kbase<br>
                kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );<br>
<br>
                System.out.println(&quot;In QueryInterceptorComponent.handleRequestBody(). q =<br>
&quot; + rb.req.getParams().get(&quot;q&quot;));<br>
<br>
                StatelessKnowledgeSession ksession = kbase.newStatelessKnowledgeSession();<br>
<br>
                SearchState searchState = new SearchState();<br>
                searchState.setSearchTerms(rb.req.getParams().get(&quot;q&quot;));<br>
<br>
                //More search state attribute setting here ...<br>
<br>
                Collection list = new ArrayList();<br>
                list.add(searchState);<br>
<br>
                ksession.execute(list);<br>
<br>
                System.out.println(&quot;EXECUTED RULES&quot;);<br>
<br>
        }<br>
<br>
} catch(Exception e) {<br>
        System.out.println(&quot;Caught exception &quot; + e);<br>
}<br>
<br>
Running in Debug mode on Tomcat and searching on &quot;monitor&quot;, I can see that I<br>
step through all of the code above without any exceptions. The console<br>
output shows me that the rule successfully fired and that the When condition<br>
was satisfied as it performed the When side of the rule; it wrote the sysout<br>
message I expected.<br>
<br>
In QueryInterceptorComponent.handleRequestBody(). q = monitor<br>
/*Created junk!!!*/<br>
EXECUTED RULES<br>
<br>
But when I then access the list collection again in the debugger, there is<br>
no SearchActions object added to the list. I&#39;ve also tried modifying the<br>
rule to just change a value on the SearchState object that is driving the<br>
When condition. That doesn&#39;t result in any object changes either.<br>
<br>
Can someone point me in the right direction? Again, I&#39;m new at this.<br>
<br>
Any assistance most greatly appreciated.<br>
<br>
Thanks,<br>
<br>
David<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Rules-Firing-Java-Objects-Not-Manipulated-tp4023270.html" target="_blank">http://drools.46999.n3.nabble.com/Rules-Firing-Java-Objects-Not-Manipulated-tp4023270.html</a><br>

Sent from the Drools: User forum mailing list archive at Nabble.com.<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></div>