airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1351769 - /incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java
Date Tue, 19 Jun 2012 16:36:36 GMT
Author: samindaw
Date: Tue Jun 19 16:36:35 2012
New Revision: 1351769

URL: http://svn.apache.org/viewvc?rev=1351769&view=rev
Log:
branch fix applied to trunk - updating optional params

Modified:
    incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java

Modified: incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java?rev=1351769&r1=1351768&r2=1351769&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java
(original)
+++ incubator/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/airavata/AiravataClient.java
Tue Jun 19 16:36:35 2012
@@ -58,6 +58,7 @@ import org.apache.airavata.workflow.mode
 import org.apache.airavata.workflow.model.graph.GraphException;
 import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
 import org.apache.airavata.workflow.model.graph.system.InputNode;
+import org.apache.airavata.workflow.model.graph.util.GraphUtil;
 import org.apache.airavata.workflow.model.wf.Workflow;
 import org.apache.airavata.xbaya.interpretor.NameValue;
 import org.apache.airavata.xbaya.interpretor.WorkflowInterpretorStub;
@@ -565,10 +566,17 @@ public class AiravataClient {
 	 */
 	public List<WorkflowInput> getWorkflowInputs(String workflowTemplateId) throws Exception{
 		try {
-			List<WSComponentPort> inputs = getWSComponentPortInputs(workflowTemplateId);
+			Workflow workflowTemplate = getWorkflow(workflowTemplateId);
+			List<WSComponentPort> inputs = getWSComponentPortInputs(workflowTemplate);
+			List<InputNode> inputNodes = getInputNodes(workflowTemplate);
 			List<WorkflowInput> results=new ArrayList<WorkflowInput>();
-			for (WSComponentPort port : inputs) {
-				results.add(new WorkflowInput(port.getName(), port.getType().getLocalPart(), port.getDefaultValue(),
port.getValue(),port.isOptional()));
+			for (InputNode port : inputNodes) {
+				Object value=null;
+				WSComponentPort wsComponentPort = getWSComponentPort(port.getName(), inputs);
+				if (wsComponentPort!=null){
+					value=wsComponentPort.getValue();
+				}
+				results.add(new WorkflowInput(port.getName(), port.getParameterType().getLocalPart(),
port.getDefaultValue(), value, !port.isVisibility()));
 			}
 			return results;
 		} catch (RegistryException e) {
@@ -598,13 +606,37 @@ public class AiravataClient {
 			String workflowTemplateId) throws RegistryException,
 			PathNotFoundException, RepositoryException, GraphException,
 			ComponentException, ValueFormatException {
+		Workflow workflow = getWorkflow(workflowTemplateId);
+		return getWSComponentPortInputs(workflow);
+	}
+
+	private Workflow getWorkflow(String workflowTemplateId)
+			throws RegistryException, PathNotFoundException,
+			RepositoryException, GraphException, ComponentException,
+			ValueFormatException {
 		Property workflowAsString = getWorkflowAsString(workflowTemplateId);
 		Workflow workflow = new Workflow(workflowAsString.getString());
+		return workflow;
+	}
+
+	private List<WSComponentPort> getWSComponentPortInputs(Workflow workflow)
+			throws GraphException, ComponentException {
 		workflow.createScript();
 		List<WSComponentPort> inputs = workflow.getInputs();
 		return inputs;
 	}
 	
+	private List<InputNode> getInputNodes(
+		String workflowTemplateId) throws PathNotFoundException, GraphException, ComponentException,
ValueFormatException, RegistryException, RepositoryException{
+		Workflow workflow = getWorkflow(workflowTemplateId);
+		return getInputNodes(workflow);
+	}
+	
+	private List<InputNode> getInputNodes(Workflow workflow) {
+		List<InputNode> inputNodes = GraphUtil.getInputNodes(workflow.getGraph());
+		return inputNodes;
+	}
+	
 	private WSComponentPort getWSComponentPort(String name,List<WSComponentPort> ports){
 		for (WSComponentPort port : ports) {
 			if (port.getName().equals(name)){



Mime
View raw message