airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1515855 - /airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java
Date Tue, 20 Aug 2013 16:08:52 GMT
Author: samindaw
Date: Tue Aug 20 16:08:52 2013
New Revision: 1515855

URL: http://svn.apache.org/r1515855
Log:
fixing context header config remove function issue

Modified:
    airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java

Modified: airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java?rev=1515855&r1=1515854&r2=1515855&view=diff
==============================================================================
--- airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java
(original)
+++ airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java
Tue Aug 20 16:08:52 2013
@@ -58,7 +58,15 @@ public class WorkflowContextHeaderBuilde
 
 
     public WorkflowContextHeaderBuilder(ContextHeaderDocument.ContextHeader document){
-        this.contextHeader = document;
+    	ContextHeaderDocument parse = null;
+		try {
+			ContextHeaderDocument doc = ContextHeaderDocument.Factory.newInstance();
+			doc.setContextHeader(document);
+			parse = ContextHeaderDocument.Factory.parse(doc.xmlText());
+		} catch (XmlException e) {
+			e.printStackTrace();
+		}
+        this.contextHeader = parse.getContextHeader();
         if (contextHeader!=null) {
 			this.securityContext = contextHeader.getSecurityContext();
 			this.workflowSchedulingContext=contextHeader.getWorkflowSchedulingContext();
@@ -174,7 +182,12 @@ public class WorkflowContextHeaderBuilde
     }
 
     public XmlElement getXml() {
-        ContextHeaderDocument document = ContextHeaderDocument.Factory.newInstance();
+        ContextHeaderDocument document = getDocument();
+        return XMLUtil.stringToXmlElement3(document.xmlText());
+    }
+
+	private ContextHeaderDocument getDocument() {
+		ContextHeaderDocument document = ContextHeaderDocument.Factory.newInstance();
         if (this.workflowMonitoringContext != null) {
             this.contextHeader.setWorkflowMonitoringContext(this.workflowMonitoringContext);
         }
@@ -194,8 +207,8 @@ public class WorkflowContextHeaderBuilde
             this.contextHeader.setWorkflowOutputDataHandling(this.workflowOutputDataHandling);
         }
         document.setContextHeader(this.contextHeader);
-        return XMLUtil.stringToXmlElement3(document.xmlText());
-    }
+		return document;
+	}
 
     public WorkflowContextHeaderBuilder setResourceSchedularUrl(String resourceSchedular)
{
         this.soaServiceEprs.setResourceSchedulerUrl(resourceSchedular);
@@ -412,15 +425,16 @@ public class WorkflowContextHeaderBuilde
     }
 
     public static ContextHeaderDocument.ContextHeader removeOtherSchedulingConfig(String
nodeID, ContextHeaderDocument.ContextHeader header) {
-        String s = XMLUtil.xmlElementToString(new WorkflowContextHeaderBuilder(header).getXml());
+    	WorkflowContextHeaderBuilder.setCurrentContextHeader(header);
+    	header=new WorkflowContextHeaderBuilder(header).getContextHeader();
         try {
             ApplicationSchedulingContextDocument.ApplicationSchedulingContext[] applicationSchedulingContextArray
=
                     header.getWorkflowSchedulingContext().getApplicationSchedulingContextArray();
-
+            
             int index = 0;
             if (applicationSchedulingContextArray != null) {
                 for (ApplicationSchedulingContextDocument.ApplicationSchedulingContext context
: applicationSchedulingContextArray) {
-                    if (context.getServiceId().equals(nodeID)) {
+                    if (context.getWorkflowNodeId().equals(nodeID)) {
                         index++;
                         header.getWorkflowSchedulingContext().setApplicationSchedulingContextArray(new
ApplicationSchedulingContextDocument.ApplicationSchedulingContext[]{context});
                         break;
@@ -447,14 +461,6 @@ public class WorkflowContextHeaderBuilde
         } catch (NullPointerException e) {
             return header;
         }
-        ContextHeaderDocument parse = null;
-        try {
-            parse = ContextHeaderDocument.Factory.parse(s);
-        } catch (XmlException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
-        }
-        //Set Old Context Header in to currentContextHeader
-        WorkflowContextHeaderBuilder.setCurrentContextHeader(parse.getContextHeader());
         return header;
     }
 



Mime
View raw message