Did you import it? From: rules-users-boun...@lists.jboss.org [mailto:rules-users-boun...@lists.jboss.org] On Behalf Of grules Sent: Wednesday, March 26, 2014 11:51 AM To: rules-users@lists.jboss.org Subject: Re: [rules-users] inserted object now working
I tried and it not compiling, here is the error.... BuildError: Unable to resolve ObjectType 'TClaim' [http://drools.46999.n3.nabble.com/attachment/4028969/0/image001.png] From: Joe White-3 [via Drools] [mailto:ml-node+[hidden email]</user/SendEmail.jtp?type=node&node=4028969&i=0>] Sent: Wednesday, March 26, 2014 1:48 PM To: Gopu Shrestha Subject: Re: [rules-users] inserted object now working You're inserting an object of type "TClaim" but your rule is written against "Claim". Change your rule to TClaim and maybe it will work. From: [hidden email]</user/SendEmail.jtp?type=node&node=4028968&i=0> [mailto:[hidden email]</user/SendEmail.jtp?type=node&node=4028968&i=1>] On Behalf Of Gopu Shrestha Sent: Wednesday, March 26, 2014 11:40 AM To: Rules Users List Subject: Re: [rules-users] inserted object now working Here is the console output.. ......CategoryOfService---------15 ......ProviderclaimNumber--130430007701 ........Executing......message rule Hello World Goodbye cruel world ........Executing......message rule From: [hidden email]</user/SendEmail.jtp?type=node&node=4028968&i=2> [[hidden email]</user/SendEmail.jtp?type=node&node=4028968&i=3>] On Behalf Of Gopu Shrestha Sent: Wednesday, March 26, 2014 1:38 PM To: Rules Users List Subject: [rules-users] inserted object now working I am struggling to identify why my another object (Claim) inserted into ksession is not working.. However, I tried the object Message() is working but not Claim(). I printed values of Claim Object its working but not in rule. Where I missed??? Please help... Here is the code. KnowledgeBase kbase = readKnowledgeBase(); StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(); // go ! Message message = new Message(); message.setMessage("Hello World"); message.setStatus(Message.HELLO); TClaim claim = loadFile(); System.out.println("......CategoryOfService---------"+claim.getClaimIdentificationInfo().getCategoryOfService().getValue());//working System.out.println("......ProviderclaimNumber--"+claim.getClaimIdentificationInfo().getProviderClaimNumber().getValue()); //working ksession.insert(message); ksession.insert(claim); ksession.fireAllRules(); private static TClaim loadFile() throws JAXBException, FileNotFoundException { JAXBContext jaxbContext = JAXBContext.newInstance("com.sample"); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); JAXBElement<?> unmarshalledObject = (JAXBElement<?>) unmarshaller.unmarshal(new FileInputStream("Encounter.xml")); TClaim claim = (TClaim) unmarshalledObject.getValue(); return claim; } private static KnowledgeBase readKnowledgeBase() throws Exception { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); kbuilder.add(ResourceFactory.newClassPathResource("Sample.drl"), ResourceType.DRL); kbuilder.add(ResourceFactory.newClassPathResource("setBaseECN.drl"), ResourceType.DRL); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() > 0) { for (KnowledgeBuilderError error: errors) { System.err.println(error); } throw new IllegalArgumentException("Could not parse knowledge."); } KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(); kbase.addKnowledgePackages(kbuilder.getKnowledgePackages()); return kbase; } ----Rule file setBaseECN.drl---- rule "testing claim rule" when Claim(); then System.out.println("..........Executing.......claim...rule.");//not working end rule "testing message rule" when Message() then System.out.println("........Executing......message rule");//working end _______________________________________________ rules-users mailing list [hidden email]</user/SendEmail.jtp?type=node&node=4028968&i=4> https://lists.jboss.org/mailman/listinfo/rules-users ________________________________ If you reply to this email, your message will be added to the discussion below: http://drools.46999.n3.nabble.com/rules-users-inserted-object-now-working-tp4028966p4028968.html To start a new topic under Drools: User forum, email [hidden email]</user/SendEmail.jtp?type=node&node=4028969&i=1> To unsubscribe from Drools, click here. NAML<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> ________________________________ View this message in context: RE: [rules-users] inserted object now working<http://drools.46999.n3.nabble.com/rules-users-inserted-object-now-working-tp4028966p4028969.html> Sent from the Drools: User forum mailing list archive<http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html> at Nabble.com.
_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users