use of org.jbpm.executor.api.ExecutionResults in project jBPM5-Developer-Guide by Salaboy.
the class CalculateHospitalRatesCommand method execute.
public ExecutionResults execute(CommandContext ctx) {
String patientId = (String) ctx.getData("rates_patientName");
BigDecimal finalAmount = BigDecimal.ZERO;
// Mock Data
List<ConceptCode> concepts = new ArrayList<ConceptCode>(2);
concepts.add(new ConceptCode("CO-123", new BigDecimal(125), "Dialy Hospital Bed Rate", 4));
concepts.add(new ConceptCode("CO-123", new BigDecimal(100), "Nurse Service", 1));
try {
InsuranceService client = getClient();
// Fixed rate for insured patients
finalAmount = client.calculateHospitalRates(patientId, concepts);
} catch (MalformedURLException ex) {
Logger.getLogger(PatientDataServiceWorkItemHandler.class.getName()).log(Level.SEVERE, null, ex);
}
ExecutionResults results = new ExecutionResults();
results.setData("rates_finalAmount", finalAmount);
results.setData("rates_concepts", concepts);
return results;
}
use of org.jbpm.executor.api.ExecutionResults 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;
}
use of org.jbpm.executor.api.ExecutionResults in project jBPM5-Developer-Guide by Salaboy.
the class CXFWebServiceCommand method execute.
public ExecutionResults execute(CommandContext ctx) {
String wsdlUrl = (String) ctx.getData("wsdlUrl");
String methodName = (String) ctx.getData("methodName");
String argumentNamesString = (String) ctx.getData("webServiceParameters");
String outputName = (String) ctx.getData("outputName");
String[] argumentNames = argumentNamesString.split(",");
Object[] arguments = new Object[argumentNames.length];
for (int index = 0; index < argumentNames.length; index++) {
Object argument = ctx.getData(argumentNames[index]);
arguments[index] = argument;
}
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
Client client = dcf.createClient(wsdlUrl, CXFWebServiceCommand.class.getClassLoader());
ExecutionResults results = new ExecutionResults();
try {
Object[] result = client.invoke(methodName, arguments);
if (result == null) {
System.out.println("Null response");
results.setData(outputName, null);
} else {
System.out.println("Echo response: " + result[0]);
results.setData(outputName, (Serializable) result[0]);
}
} catch (Exception e) {
results.setData(outputName, e);
System.out.println("Exception inside CXFCmd: " + e.getMessage());
e.printStackTrace(System.out);
}
return results;
}
use of org.jbpm.executor.api.ExecutionResults 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;
}
use of org.jbpm.executor.api.ExecutionResults in project jBPM5-Developer-Guide by Salaboy.
the class PrintOutCommand method execute.
public ExecutionResults execute(CommandContext ctx) {
System.out.println(">>> Hi This is the first command!");
ExecutionResults executionResults = new ExecutionResults();
return executionResults;
}
Aggregations