Search in sources :

Example 6 with InsuranceService

use of com.salaboy.jbpm5.dev.guide.webservice.InsuranceService in project jBPM5-Developer-Guide by Salaboy.

the class CalculateHospitalRatesCommand method getClient.

private InsuranceService getClient() throws MalformedURLException {
    URL wsdlURL = new URL("http://127.0.0.1:19999/InsuranceServiceImpl/insurance?WSDL");
    QName SERVICE_QNAME = new QName("http://webservice.guide.dev.jbpm5.salaboy.com/", "InsuranceServiceImplService");
    Service service = Service.create(wsdlURL, SERVICE_QNAME);
    InsuranceService client = service.getPort(InsuranceService.class);
    return client;
}
Also used : InsuranceService(com.salaboy.jbpm5.dev.guide.webservice.InsuranceService) QName(javax.xml.namespace.QName) InsuranceService(com.salaboy.jbpm5.dev.guide.webservice.InsuranceService) Service(javax.xml.ws.Service) URL(java.net.URL)

Example 7 with InsuranceService

use of com.salaboy.jbpm5.dev.guide.webservice.InsuranceService in project jBPM5-Developer-Guide by Salaboy.

the class GetPatientDataCommand method getClient.

private InsuranceService getClient() throws MalformedURLException {
    URL wsdlURL = new URL("http://127.0.0.1:19999/InsuranceServiceImpl/insurance?WSDL");
    QName SERVICE_QNAME = new QName("http://webservice.guide.dev.jbpm5.salaboy.com/", "InsuranceServiceImplService");
    Service service = Service.create(wsdlURL, SERVICE_QNAME);
    InsuranceService client = service.getPort(InsuranceService.class);
    return client;
}
Also used : InsuranceService(com.salaboy.jbpm5.dev.guide.webservice.InsuranceService) QName(javax.xml.namespace.QName) InsuranceService(com.salaboy.jbpm5.dev.guide.webservice.InsuranceService) Service(javax.xml.ws.Service) URL(java.net.URL)

Example 8 with InsuranceService

use of com.salaboy.jbpm5.dev.guide.webservice.InsuranceService in project jBPM5-Developer-Guide by Salaboy.

the class NotifyInsuranceCompanyCommand method execute.

public ExecutionResults execute(CommandContext ctx) {
    String patientId = (String) ctx.getData("company_patientName");
    BigDecimal finalAmount = BigDecimal.ZERO;
    try {
        InsuranceService client = getClient();
        // Fixed rate for insured patients
        finalAmount = client.notifyInsuranceCompany("Company 1", patientId, new BigDecimal(100));
    } catch (MalformedURLException ex) {
        ex.printStackTrace();
    }
    ExecutionResults results = new ExecutionResults();
    results.setData("company_finalAmount", finalAmount);
    List<ConceptCode> concepts = new ArrayList<ConceptCode>(1);
    concepts.add(new ConceptCode("CO-9999", finalAmount, " Insured Flat Rate", 1));
    results.setData("company_concepts", concepts);
    return results;
}
Also used : ConceptCode(com.salaboy.jbpm5.dev.guide.model.ConceptCode) MalformedURLException(java.net.MalformedURLException) InsuranceService(com.salaboy.jbpm5.dev.guide.webservice.InsuranceService) ExecutionResults(org.jbpm.executor.api.ExecutionResults) ArrayList(java.util.ArrayList) BigDecimal(java.math.BigDecimal)

Example 9 with InsuranceService

use of com.salaboy.jbpm5.dev.guide.webservice.InsuranceService in project jBPM5-Developer-Guide by Salaboy.

the class IsPatientInsuredCommand method execute.

public ExecutionResults execute(CommandContext ctx) {
    String patientId = (String) ctx.getData("insured_patientName");
    boolean isPatientInsured = false;
    try {
        InsuranceService client = getClient();
        isPatientInsured = client.isPatientInsured(patientId);
    } catch (MalformedURLException ex) {
        ex.printStackTrace();
    }
    ExecutionResults results = new ExecutionResults();
    results.setData("insured_isPatientInsured", isPatientInsured);
    return results;
}
Also used : MalformedURLException(java.net.MalformedURLException) InsuranceService(com.salaboy.jbpm5.dev.guide.webservice.InsuranceService) ExecutionResults(org.jbpm.executor.api.ExecutionResults)

Example 10 with InsuranceService

use of com.salaboy.jbpm5.dev.guide.webservice.InsuranceService in project jBPM5-Developer-Guide by Salaboy.

the class InsuranceServiceWorkItemHandler method executeWorkItem.

public void executeWorkItem(WorkItem wi, WorkItemManager wim) {
    String patientId = (String) wi.getParameter("insured_patientName");
    boolean isPatientInsured = false;
    InsuranceService client = getClient();
    isPatientInsured = client.isPatientInsured(patientId);
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("insured_isPatientInsured", isPatientInsured);
    wim.completeWorkItem(wi.getId(), result);
}
Also used : InsuranceService(com.salaboy.jbpm5.dev.guide.webservice.InsuranceService) HashMap(java.util.HashMap)

Aggregations

InsuranceService (com.salaboy.jbpm5.dev.guide.webservice.InsuranceService)20 URL (java.net.URL)10 QName (javax.xml.namespace.QName)10 Service (javax.xml.ws.Service)10 MalformedURLException (java.net.MalformedURLException)9 ConceptCode (com.salaboy.jbpm5.dev.guide.model.ConceptCode)6 BigDecimal (java.math.BigDecimal)6 HashMap (java.util.HashMap)5 ExecutionResults (org.jbpm.executor.api.ExecutionResults)5 Patient (com.salaboy.jbpm5.dev.guide.model.Patient)4 ArrayList (java.util.ArrayList)4 List (java.util.List)2 PatientDataServiceWorkItemHandler (com.salaboy.jbpm5.dev.guide.workitems.PatientDataServiceWorkItemHandler)1