I tried and it not compiling, here is the error….

BuildError: Unable to resolve ObjectType 'TClaim'

 

 

 

From: Joe White-3 [via Drools] [mailto:ml-node+[hidden email]]
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] [mailto:[hidden email]] 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] [[hidden email]] 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]
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]
To unsubscribe from Drools, click here.
NAML



View this message in context: RE: [rules-users] inserted object now working
Sent from the Drools: User forum mailing list archive at Nabble.com.