airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1396117 - /airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
Date Tue, 09 Oct 2012 17:12:51 GMT
Author: samindaw
Date: Tue Oct  9 17:12:51 2012
New Revision: 1396117

URL: http://svn.apache.org/viewvc?rev=1396117&view=rev
Log:
whenever you update the node status update the workflow status update time as well

Modified:
    airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java

Modified: airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java?rev=1396117&r1=1396116&r2=1396117&view=diff
==============================================================================
--- airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
(original)
+++ airavata/trunk/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/AiravataJPARegistry.java
Tue Oct  9 17:12:51 2012
@@ -1176,17 +1176,22 @@ public class AiravataJPARegistry extends
 	public boolean updateWorkflowNodeStatus(
 			WorkflowInstanceNodeStatus workflowStatusNode)
 			throws RegistryException {
-		if (!isWorkflowInstanceNodePresent(workflowStatusNode.getWorkflowInstanceNode().getWorkflowInstance().getWorkflowInstanceId(),
workflowStatusNode.getWorkflowInstanceNode().getNodeId(), true)){
-			throw new WorkflowInstanceNodeDoesNotExistsException(workflowStatusNode.getWorkflowInstanceNode().getWorkflowInstance().getWorkflowInstanceId(),
workflowStatusNode.getWorkflowInstanceNode().getNodeId());
+		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(workflowStatusNode.getWorkflowInstanceNode().getWorkflowInstance().getWorkflowInstanceId()).getNodeData(workflowStatusNode.getWorkflowInstanceNode().getNodeId());
+		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(new Timestamp(workflowStatusNode.getStatusUpdateTime().getTime()));
+			nodeData.setStartTime(t);
 		}
-		nodeData.setLastUpdateTime(new Timestamp(workflowStatusNode.getStatusUpdateTime().getTime()));
+		nodeData.setLastUpdateTime(t);
 		nodeData.save();
-		return true;
+		//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());
+		return updateWorkflowInstanceStatus(new WorkflowInstanceStatus(workflowInstance, currentWorkflowInstanceStatus.getExecutionStatus(),t));
 	}
 
 



Mime
View raw message