Thanks Joe,
Its working....
From: Joe White-3 [via Drools] [mailto:ml-node+s46999n4028970h13@n3.nabble.com]
Sent: Wednesday, March 26, 2014 1:53 PM
To: Gopu Shrestha
Subject: Re: [rules-users] inserted object now working
Did you import it?
From: [hidden email]</user/SendEmail.jtp?type=node&node=4028970&i=0>
[mailto:[hidden email]</user/SendEmail.jtp?type=node&node=4028970&i=1>] On
Behalf Of grules
Sent: Wednesday, March 26, 2014 11:51 AM
To: [hidden email]</user/SendEmail.jtp?type=node&node=4028970&i=2>
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...
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=...
________________________________
View this message in context: RE: [rules-users] inserted object now
working<http://drools.46999.n3.nabble.com/rules-users-inserted-object-...
Sent from the Drools: User forum mailing list
archive<http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.htm... at
Nabble.com.
_______________________________________________
rules-users mailing list
[hidden email]</user/SendEmail.jtp?type=node&node=4028970&i=3>
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...
To start a new topic under Drools: User forum, email
ml-node+s46999n47000h43@n3.nabble.com<mailto:ml-node+s46999n47000h43@n3.nabble.com>
To unsubscribe from Drools, click
here<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=...;.
NAML<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=...
--
View this message in context:
http://drools.46999.n3.nabble.com/rules-users-inserted-object-now-working...
Sent from the Drools: User forum mailing list archive at
Nabble.com.