[rules-users] Problem with proxy objects

Wolfgang Laun wolfgang.laun at gmail.com
Fri Feb 5 11:13:03 EST 2010


<quote from="Drools Expert Manual">
Unfortunately a Java array does not implement the Iterable  interface,
so we have to use the JDK converter method Arrays.asList(...).
</quote>

Try
  ksession.execute( Arrays.asList( new Object[] { myObject} ) );

-W

2010/2/5 Rogerio Baldini <rogerio.baldini at powerlogic.com.br>:
> Hi guys,
>
>
>
> I am trying to execute rules passing a proxy object to it.
>
> The object myObject is a javassist proxy object:
> package.MyClass_$$_javassist_2
>
>
>
> Properties p = new Properties();
>
> p.put("url",
> "http://localhost:8090/drools-guvnor/org.drools.guvnor.Guvnor/package/pacote/LATEST");
>
>
>
> RuleAgent agent = RuleAgent.newRuleAgent(p);
>
> RuleBase ruleBase = agent.getRuleBase();
>
>
>
> StatelessSession ksession = ruleBase.newStatelessSession();
>
>
>
> ksession.execute(new Object[] {myObject});
>
>
>
>
>
> So, with this proxy object, my rule is not executed. If I pass a real
> instance, the rule works fine.
>
>
>
> package mypackage;
>
> import  package.MyClass;
>
>
>
> global java.util.List list
>
>
>
> rule "Testing"
>
>     dialect "java"
>
>                 when
>
>                     f: MyClass()
>
>                 then
>
>     System.out.println("Exist "+f.getDay());
>
>                     f.setDay("15");
>
> end
>
>
>
>
>
> Can anybody help me ?
>
> Thanks,
>
> Rogerio
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>




More information about the rules-users mailing list