@Override
public void updateWorkflowNodeStatus(
WorkflowInstanceNodeStatus workflowStatusNode)
throws RegistryException {
WorkflowInstance workflowInstance = workflowStatusNode.getWorkflowInstanceNode().getWorkflowInstance();
String nodeId = workflowStatusNode.getWorkflowInstanceNode().getNodeId();
if (!isWorkflowInstanceNodePresent(workflowInstance.getWorkflowInstanceId(), nodeId, true)){
throw new WorkflowInstanceNodeDoesNotExistsException(workflowInstance.getWorkflowInstanceId(), nodeId);
}
NodeDataResource nodeData = jpa.getWorker().getWorkflowInstance(workflowInstance.getWorkflowInstanceId()).getNodeData(nodeId);
nodeData.setStatus(workflowStatusNode.getExecutionStatus().toString());
Timestamp t = new Timestamp(workflowStatusNode.getStatusUpdateTime().getTime());
if (workflowStatusNode.getExecutionStatus()==ExecutionStatus.STARTED){
nodeData.setStartTime(t);
}
nodeData.setLastUpdateTime(t);
nodeData.save();
//Each time node status is updated the the time of update for the workflow status is going to be the same
WorkflowInstanceStatus currentWorkflowInstanceStatus = getWorkflowInstanceStatus(workflowInstance.getWorkflowInstanceId());
updateWorkflowInstanceStatus(new WorkflowInstanceStatus(workflowInstance, currentWorkflowInstanceStatus.getExecutionStatus(), t));
}