Re: [rules-users] Drools5.2.2 integration with scala2.9.0.1
Hi, I just tried the same and indeed the code as presented in the post you linked cannot work. The problem is that MVEL tries to read the field "value" of the Temperature class by following the JavaBean specification, i.e. by looking for a method named "getValue()". It means that if you change the method name of the Temperature trait from "value" to "getValue" the code works as expected. To be honest is quite ugly to use a Scala trait to model a domain object as done in that example. I'd rather suggest to use a case class as it follows: case class Temperature(@BeanProperty value: Int) so in this way you can create your Temperature objects as simple as: val shouldBeTooHot = Temperature(100) Note that I annotated the "value" field of the case class with @BeanProperty in order to tell to the Scala compiler to generate an accessor to that field that is compatible with the JavaBean specification. I created a public github project and made available the complete working example there: https://github.com/mariofusco/scaladrools I will continue enriching this project with other Scala/Drools integration attempts in my spare time. I hope this helps. Cheers, Mario Fusco -- View this message in context: http://drools.46999.n3.nabble.com/Drools5-2-2-integration-with-scala2-9-0-1-tp3229566p3231390.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Guvnor - Unable to load a required class !! Help
Hello All I create a JavaBean and convert it to a Jar File then upload it. Also i create a sample rule that uses uploaded Jar File then i create a test scenario to test my rule but when i run my scenario Guvnor says : Unable to load a required class ! Unable to find class 'Fire' ! my java bean is like it : package com.employee; import java.util.Date; public class Fire { private Room room; private Date time; public Fire(){} public Fire(Room room,Date time) { this.room = room; this.time = time; } public Room getRoom() { return room; } public void setRoom(Room room) { this.room = room; } public Date getTime() { return time; } public void setTime(Date time) { this.time = time; } } Any Help Appreciated Thanks in advance S.M.H.Jamali___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Insert a fact into drools server from a web application or java application
So you did not create the classes defining the XML structure from an XMl schema using xjc? You might get around this by adding, to each package where one of those files is located, a file called jaxb.index containing a newline separated list of class names relative to the very same containing package. So, if you have a class a.b.c.Doo, the jaxb.index in a.b.c contains a line "Foo". See the javadoc for javax.xml.bind.JAXBContext. Try to marshal your object locally by creating a JAXBContext, a Marshaller from it, and marshal to System.out. -W On 6 August 2011 00:13, kkelleyjr wrote: > Thank you for the response... Unfortunately, I have read this and still > kinda > lost on what any of that means... Is there an example with drools that I > can > look at to help me see this a little better? > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Insert-a-fact-into-drools-server-from-a-web-application-or-java-application-tp3214229p3229963.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Inserting multiple objects of the same class as facts
Looks like one of the $ldapResponseMap : Map() entries for keys "zimbraDomainName" or "zimbraDomainType" is not there. -W 2011/8/5 Devarakonda, Murty > Hello, > I am facing a problem with the following code with Drools 5.0.1: > > I insert multiple objects as facts into my stateful session here: > > === > StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); > > /** mapTypes here is an array of MapType objects **/ > for(int i=0;i System.out.println("Inserting the fact type: " + mapTypes[i]); > ksession.insert(mapTypes[i]); > } > > ksession.insert(ldapLookupKey); > ksession.insert(ldapResponseMap); > > ksession.fireAllRules(); > ksession.dispose(); > === > > And here is my drools file: > > === > > rule "LocalRecipient" > when > $myMapType : MapType( name == "LocalRecipient" ) > $lookupKey : String() > $ldapResponseMap : Map() > eval( > ((($ldapResponseMap.get("zimbraMailDeliveryAddress").equals($lookupKey)) || > > ($ldapResponseMap.get("zimbraMailAlias").equals($lookupKey)) || > > ($ldapResponseMap.get("zimbraMailCatchAllAddress").equals($lookupKey))) && > > ($ldapResponseMap.get("zimbraMailStatus").equals("enabled"))) ) > then > System.out.println("This LocalRecipient rule should work"); > $myMapType.setQueryFilterCheck(true); > end > > > > rule "VirtualMailboxDomain" > when > $myMapType : MapType( name == "VirtualMailboxDomain" ) > $lookupKey : String() > $ldapResponseMap : Map() > eval( > (($ldapResponseMap.get("zimbraDomainName").equals($lookupKey)) && >($ldapResponseMap.get("zimbraDomainType").equals("local")) > && > > ($ldapResponseMap.get("zimbraMailStatus").equals("enabled"))) ) > then > System.out.println("This VirtualMailboxDomain rule should work"); > $myMapType.setQueryFilterCheck(true); > End > > === > > > Now the problem I am facing is, as long as I defined only rule001 above, > it works like a charm and the MapType.QueryFilterCheck flag gets set to > TRUE. > > As soon I put the rule002 above, I started getting a NullPointerException > with the following lines in the stack trace. > > === > Caused by: java.lang.NullPointerException > at > com.aol.postfixcache.Rule_LocalRecipient_Rule_0.eval0(Rule_LocalRecipient_Rule_0.java:8) > at > com.aol.postfixcache.Rule_LocalRecipient_Rule_0Eval0Invoker.evaluate(Rule_LocalRecipient_Rule_0Eval0Invoker.java:23) > at org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:117) > === > > > I tried different combinations along with an extensive search to see why > I am getting this, but couldn't crack it. Appreciate your help. > > Regards, > Murty. > > > > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users