You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by he...@apache.org on 2012/03/02 17:20:16 UTC

svn commit: r1296283 - /incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/MigrationUtil.java

Author: heshan
Date: Fri Mar  2 16:20:15 2012
New Revision: 1296283

URL: http://svn.apache.org/viewvc?rev=1296283&view=rev
Log:
Setting parameter type to the service description.

Modified:
    incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/MigrationUtil.java

Modified: incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/MigrationUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/MigrationUtil.java?rev=1296283&r1=1296282&r2=1296283&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/MigrationUtil.java (original)
+++ incubator/airavata/trunk/modules/registry-migrator/src/main/java/org/apache/airavata/migrator/registry/MigrationUtil.java Fri Mar  2 16:20:15 2012
@@ -53,10 +53,7 @@ public class MigrationUtil {
                 InputParameterType input = InputParameterType.Factory.newInstance();
                 String inputParamName = inputParameterType.getName();
                 input.setParameterName(inputParamName);
-
-                //TODO properly set the type
-                String type = inputParameterType.getType();
-                input.setParameterType(StringParameterType.Factory.newInstance());
+                input.setParameterType(createParameterType(inputParameterType));
                 inputList.add(input);
             }
             InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);
@@ -70,10 +67,7 @@ public class MigrationUtil {
                 String outputParamName = outputParameterType.getName();
                 OutputParameterType output = OutputParameterType.Factory.newInstance();
                 output.setParameterName(outputParamName);
-
-                //TODO properly set the type
-                String en = outputParameterType.getType();
-                output.setParameterType(StringParameterType.Factory.newInstance());
+                output.setParameterType(createParameterType(outputParameterType));
                 outputList.add(output);
 
             }
@@ -84,6 +78,20 @@ public class MigrationUtil {
         return serv;
     }
 
+    private static ParameterType createParameterType(ParamObject outputParameterType) {
+        String en = outputParameterType.getType();
+
+        //DataType dt;
+        if("String".equalsIgnoreCase(en)) {
+            return StringParameterType.Factory.newInstance();
+        } else if ("double".equalsIgnoreCase(en)) {
+            return DoubleParameterType.Factory.newInstance();
+        } else {
+            // TODO check
+            return StringParameterType.Factory.newInstance();
+        }
+    }
+
     /**
      * Creates ApplicationDeploymentDescription from ApplicationBean
      * @param appBean ApplicationBean