@Override
 public void beginWorkflowItemErrorHandler(int step, StepExecutionItem item) {
   stepContext.beginStepContext(StateUtils.stepContextId(step, true));
   HashMap<String, String> ehMap = new HashMap<String, String>();
   ehMap.put("handlerTriggered", "true");
   notifyAllStepState(
       createIdentifier(),
       createStepStateChange(ExecutionState.RUNNING_HANDLER, ehMap),
       new Date());
 }
 private Map<String, Object> resultMetadata(StepExecutionResult result) {
   if (null != result && result.isSuccess()) {
     return null;
   }
   HashMap<String, Object> map = new HashMap<String, Object>();
   if (null != result && null != result.getFailureData()) {
     map.putAll(result.getFailureData());
   }
   map.put("failureReason", null != result ? result.getFailureReason().toString() : "Unknown");
   return map;
 }
 public void beginWorkflowExecution(
     StepExecutionContext executionContext, WorkflowExecutionItem item) {
   StepContextId currentStep = stepContext.getCurrentStep();
   INodeEntry currentNode = stepContext.getCurrentNode();
   if (null != currentNode && null != currentStep) {
     // if already node context, begin a parameterized sub workflow
     // change step context to include node name parameter for the step id
     HashMap<String, String> params = new HashMap<String, String>();
     params.put("node", currentNode.getNodename());
     stepContext.beginStepContext(
         StateUtils.stepContextId(
             currentStep.getStep(), !currentStep.getAspect().isMain(), params));
   }
   stepContext.beginContext();
   List<Pair<StepContextId, INodeEntry>> currentContext = stepContext.getCurrentContextPairs();
   List<String> names = getNodeNames(executionContext);
   if (null == currentContext) {
     notifyAllWorkflowState(ExecutionState.RUNNING, new Date(), names);
   } else {
     notifyAllSubWorkflowState(createIdentifier(), ExecutionState.RUNNING, new Date(), names);
   }
 }