/** * Completes the Work Item this handler makes reference to. * @param results */ public void completeWorkItem(Map<String, Object> results){ this.manager.completeWorkItem(workItemId, results); }
public void completeWorkItem(long id, Map<String, Object> results) { delegate.completeWorkItem(id, results); }
public void completeWorkItem() { results = new HashMap<String, Object>(); results.put("emergency", currentEmergency); workItemManager.completeWorkItem(workItemId, results); }
public void completeWorkItem() { results = new HashMap<String, Object>(); results.put("emergency", currentEmergency); workItemManager.completeWorkItem(workItemId, results); }
@Override public void completeWorkItem(long workItemId, Map<String, Object> outputParameters) { ksession.getWorkItemManager().completeWorkItem(workItemId, outputParameters); }
/** * This method should be invoked by an external system when it finished the * execution of a job. * This method will complete the work item associated with the passed job id. * At this point, the process associated with the work item will continue * its execution. * This method will also calculate the total execution time of the job and * pass it as an output parameter. * @param externalSystemJobId * @param parameters */ public void externalSystemJobCompleted(String externalSystemJobId, Map<String,Object> parameters){ //gets the work item id associated with the job id. Long workItemId = this.workItemsIdsMap.remove(externalSystemJobId); //calculates the execution time of the job long currentTimeMillis = System.currentTimeMillis(); Long startTime = this.jobTimestampsMap.remove(externalSystemJobId); double executionTime = (currentTimeMillis - startTime)/1000; //set the execution time in the output parameters parameters.put("trackingExecutionTime", executionTime); //Completes the work item ksession.getWorkItemManager().completeWorkItem(workItemId, parameters); }
public Void execute(Context context) { StatefulKnowledgeSession ksession = ((KnowledgeCommandContext) context).getStatefulKnowledgesession(); ksession.getWorkItemManager().completeWorkItem(workItemId, results); return null; }
public void execute(Content content) { ByteArrayInputStream bis = new ByteArrayInputStream(content.getContent()); ObjectInputStream in; try { in = new ObjectInputStream(bis); Object result = in.readObject(); in.close(); results.put("Result", result); if (result instanceof Map) { Map<?, ?> map = (Map) result; for (Map.Entry<?, ?> entry : map.entrySet()) { if (entry.getKey() instanceof String) { results.put((String) entry.getKey(), entry.getValue()); } } } manager.completeWorkItem(task.getTaskData().getWorkItemId(), results); } catch (IOException e) { logger.error(e.getMessage(), e); } catch (ClassNotFoundException e) { logger.error(e.getMessage(), e); } } }
public void execute(Content content) { ByteArrayInputStream bis = new ByteArrayInputStream(content.getContent()); ObjectInputStream in; try { in = new ObjectInputStream(bis); Object result = in.readObject(); in.close(); results.put("Result", result); if (result instanceof Map) { Map<?, ?> map = (Map) result; for (Map.Entry<?, ?> entry : map.entrySet()) { if (entry.getKey() instanceof String) { results.put((String) entry.getKey(), entry.getValue()); } } } session.getWorkItemManager().completeWorkItem(task.getTaskData().getWorkItemId(), results); } catch (IOException e) { logger.error(e.getMessage(), e); } catch (ClassNotFoundException e) { logger.error(e.getMessage(), e); } } }
public void executeWorkItem(WorkItem wi, WorkItemManager wim) { String patientId = (String) wi.getParameter("company_patientName"); BigDecimal finalAmount = BigDecimal.ZERO; InsuranceService client = getClient(); //Fixed rate for insured patients finalAmount = client.notifyInsuranceCompany("Company 1", patientId, new BigDecimal(100)); Map<String, Object> result = new HashMap<String, Object>(); result.put("company_finalAmount", finalAmount); List<ConceptCode> concepts = new ArrayList<ConceptCode>(1); concepts.add(new ConceptCode("CO-9999", finalAmount, " Insured Flat Rate", 1)); result.put("company_concepts", concepts); wim.completeWorkItem(wi.getId(), result); }
public void executeWorkItem(WorkItem wi, WorkItemManager wim) { Car car = (Car)wi.getParameter("carInput"); System.out.println("Defining Car Price"+car); StatelessKnowledgeSession session = createStatelessSession(); session.execute(car); Map<String, Object> params = new HashMap<String, Object>(); params.put("carOutput", car); wim.completeWorkItem(wi.getId(), params); }
public void executeWorkItem(WorkItem wi, WorkItemManager wim) { String patientId = (String) wi.getParameter("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)); InsuranceService client = getClient(); //Fixed rate for insured patients finalAmount = client.calculateHospitalRates(patientId, concepts); Map<String, Object> result = new HashMap<String, Object>(); result.put("rates_finalAmount", finalAmount); result.put("rates_concepts", concepts); wim.completeWorkItem(wi.getId(), result); }
public void executeWorkItem(WorkItem wi, WorkItemManager wim) { Car car = (Car)wi.getParameter("carInput"); System.out.println("Ranking Car"+car); StatelessKnowledgeSession session = createStatelessSession(); session.execute(car); Map<String, Object> params = new HashMap<String, Object>(); params.put("carOutput", car); wim.completeWorkItem(wi.getId(), params); }
public void executeWorkItem(WorkItem wi, WorkItemManager wim) { String patientId = (String) wi.getParameter("gatherdata_patientName"); Patient patientData = null; InsuranceService client = getClient(); patientData = client.getPatientData(patientId); Map<String, Object> result = new HashMap<String, Object>(); result.put("gatherdata_patient", patientData); wim.completeWorkItem(wi.getId(), result); }
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); }
public void completeWorkItem(long workItemId, Map<String, Object> outputParameters) { StatefulKnowledgeSession ksession = this.getKnowledgeSession(); ksession.getWorkItemManager().completeWorkItem(workItemId, outputParameters); ksession.dispose(); }
public void executeWorkItem(WorkItem wi, WorkItemManager wim) { Patient patient = (Patient) wi.getParameter("invoice_patient"); BigDecimal finalAmount = (BigDecimal) wi.getParameter("invoice_finalAmount"); List<ConceptCode> concepts = (List<ConceptCode>) wi.getParameter("invoice_concepts"); boolean patientNotified = false; InsuranceService client = getClient(); patientNotified = client.notifyAndChargePatient(patient, finalAmount, concepts); System.out.println(" >>> Patient Notified = " + patientNotified); Map<String, Object> result = new HashMap<String, Object>(); result.put("invoice_patientNotified", patientNotified); wim.completeWorkItem(wi.getId(), result); }
Boolean waitTillComplete = sWaitTillComplete == null ? null : Boolean.valueOf(sWaitTillComplete); if (waitTillComplete == null || !waitTillComplete.booleanValue()) { manager.completeWorkItem(workItemId, workItem.getResults());
public void execute(Task task) { long workItemId = task.getTaskData().getWorkItemId(); if (task.getTaskData().getStatus() == Status.Completed) { String userId = task.getTaskData().getActualOwner().getId(); Map<String, Object> results = new HashMap<String, Object>(); results.put("ActorId", userId); long contentId = task.getTaskData().getOutputContentId(); if (contentId != -1) { GetContentResponseHandler getContentResponseHandler = new GetResultContentResponseHandler(manager, task, results); client.getContent(contentId, getContentResponseHandler); } else { manager.completeWorkItem(workItemId, results); } } else { manager.abortWorkItem(workItemId); } } }
public void execute(Task task) { long workItemId = task.getTaskData().getWorkItemId(); if (task.getTaskData().getStatus() == Status.Completed) { String userId = task.getTaskData().getActualOwner().getId(); Map<String, Object> results = new HashMap<String, Object>(); results.put("ActorId", userId); long contentId = task.getTaskData().getOutputContentId(); if (contentId != -1) { GetContentResponseHandler getContentResponseHandler = new GetResultContentResponseHandler(task, results); client.getContent(contentId, getContentResponseHandler); } else { session.getWorkItemManager().completeWorkItem(workItemId, results); } } else { session.getWorkItemManager().abortWorkItem(workItemId); } } }