protected void handleException(Throwable cause, Map<String, Object> handlerInfoMap) { if (handlingProcessId != null && handlingStrategy != null) { throw new ProcessWorkItemHandlerException(handlingProcessId, handlingStrategy, cause); } String service = (String) handlerInfoMap.get("Interface"); String operation = (String) handlerInfoMap.get("Operation"); if (this.logThrownException) { String message; if (service != null) { message = this.getClass().getSimpleName() + " failed when calling " + service + "." + operation; } else { message = this.getClass().getSimpleName() + " failed while trying to complete the task."; } logger.error(message, cause); } else { WorkItemHandlerRuntimeException wihRe = new WorkItemHandlerRuntimeException(cause); for (String key : handlerInfoMap.keySet()) { wihRe.setInformation(key, handlerInfoMap.get(key)); } wihRe.setInformation(WorkItemHandlerRuntimeException.WORKITEMHANDLERTYPE, this.getClass().getSimpleName()); throw wihRe; } }
@Override public void executeWorkItem(WorkItem workItem, WorkItemManager manager) { this.workItem = workItem; if (processId != null && strategy != null) { if (workItem.getParameter("isCheckedCheckbox") != null) { manager.completeWorkItem(workItem.getId(), workItem.getParameters()); } else { throw new ProcessWorkItemHandlerException(processId, strategy, new RuntimeException("On purpose")); } } manager.completeWorkItem(workItem.getId(), null); }
protected void handleException(Throwable cause, Map<String, Object> handlerInfoMap) { if (handlingProcessId != null && handlingStrategy != null) { throw new ProcessWorkItemHandlerException(handlingProcessId, handlingStrategy, cause); } String service = (String) handlerInfoMap.get("Interface"); String operation = (String) handlerInfoMap.get("Operation"); if (this.logThrownException) { String message; if (service != null) { message = this.getClass().getSimpleName() + " failed when calling " + service + "." + operation; } else { message = this.getClass().getSimpleName() + " failed while trying to complete the task."; } logger.error(message, cause); } else { WorkItemHandlerRuntimeException wihRe = new WorkItemHandlerRuntimeException(cause); for (String key : handlerInfoMap.keySet()) { wihRe.setInformation(key, handlerInfoMap.get(key)); } wihRe.setInformation(WorkItemHandlerRuntimeException.WORKITEMHANDLERTYPE, this.getClass().getSimpleName()); throw wihRe; } }
@Override public void executeWorkItem(WorkItem workItem, WorkItemManager manager) { this.workItem = workItem; if (processId != null && strategy != null) { if (workItem.getParameter("isCheckedCheckbox") != null) { manager.completeWorkItem(workItem.getId(), workItem.getParameters()); } else { throw new ProcessWorkItemHandlerException(processId, strategy, new RuntimeException("On purpose")); } } manager.completeWorkItem(workItem.getId(), null); }