HI
package com.ldi;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Unmarshaller;
import org.drools.runtime.rule.FactHandle;
import com.ldi.facts.LdiRulesHelper;
import com.ldi.facts.ListOfCompetency;
import com.ldi.facts.SchemeEligibility;
import com.ldi.facts.Schemes;
@WebService
public class ValidateScheme {
@WebMethod
public SchemeEligibility validateScheme(
@WebParam(name = "schemeheader") String schemeheader) {
System.out.println("================================");
System.out.println("ValidateScheme");
System.out.println("================================");
System.out.println(schemeheader);
InputStream is = new ByteArrayInputStream(schemeheader.getBytes());
SchemeEligibility service = null;
LdiRulesHelper tresholdList = null;
JAXBContext jc;
Unmarshaller u;
try {
System.out.println("===============================");
System.out.println("Inside ValidateScheme try block");
jc = JAXBContext.newInstance("com.ldi.facts");
u = jc.createUnmarshaller();
JAXBElement element = (JAXBElement) u.unmarshal(is);
service = (SchemeEligibility) element.getValue();
System.out.println("After element.getValue()");
System.out.println(service);
PopulateFacts.getKnowledgeSession().insert(service);
/*
* for(LdiQuoteLine line : service.getLdiQuoteLine())
* PopulateFacts.getKnowledgeSession().insert(line);
*/
tresholdList = new LdiRulesHelper();
PopulateFacts.getKnowledgeSession().insert(tresholdList);
PopulateFacts.getKnowledgeSession().startProcess("SchemeEligibility");
System.out.println("Try to find SchemeEligibility process");
PopulateFacts.getKnowledgeSession().fireAllRules();
} catch (Exception e) {
e.printStackTrace();
} finally {
FactHandle helperHandle = PopulateFacts.getKnowledgeSession()
.getFactHandle(tresholdList);
if (helperHandle != null)
PopulateFacts.getKnowledgeSession().retract(helperHandle);
FactHandle headerHandle = PopulateFacts.getKnowledgeSession()
.getFactHandle(service);
if (headerHandle != null)
PopulateFacts.getKnowledgeSession().retract(headerHandle);
/*
for(ListOfCompetency eligibility:service.getListOfCompetency())
{
FactHandle lineHandle
=PopulateFacts.getKnowledgeSession().getFactHandle(eligibility);
if(lineHandle!=null)
PopulateFacts.getKnowledgeSession().retract(lineHandle);
System.out.println("List Competency hellooo");
}*/
System.out.println("==================================");
System.out.println("header retracted");
System.out.println("==================================");
}
return service;
}
}
This is the code I am using...
Regards
Ganesh N
--
View this message in context:
http://drools.46999.n3.nabble.com/java-lang-boolean-cannot-be-cast-to-org...
Sent from the Drools: User forum mailing list archive at
Nabble.com.