@Override
public void updateWorkflowNodeStatus(NodeExecutionStatus workflowStatusNode) throws RegistryException {
if (provenanceRegistry != null){
provenanceRegistry.updateWorkflowNodeStatus(workflowStatusNode);
}else {
WorkflowExecution workflowInstance = workflowStatusNode.getWorkflowInstanceNode().getWorkflowInstance();
String nodeId = workflowStatusNode.getWorkflowInstanceNode().getNodeId();
if (!isWorkflowInstanceNodePresent(workflowInstance.getWorkflowExecutionId(), nodeId, true)){
throw new WorkflowInstanceNodeDoesNotExistsException(workflowInstance.getWorkflowExecutionId(), nodeId);
}
NodeDataResource nodeData = jpa.getWorker().getWorkflowInstance(workflowInstance.getWorkflowExecutionId()).getNodeData(nodeId);
nodeData.setStatus(workflowStatusNode.getExecutionStatus().toString());
Timestamp t = new Timestamp(workflowStatusNode.getStatusUpdateTime().getTime());
if (workflowStatusNode.getExecutionStatus()==State.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
WorkflowExecutionStatus currentWorkflowInstanceStatus = getWorkflowInstanceStatus(workflowInstance.getWorkflowExecutionId());
updateWorkflowInstanceStatus(new WorkflowExecutionStatus(workflowInstance, currentWorkflowInstanceStatus.getExecutionStatus(), t));
}
}