[ARVADOS] updated: a3cd0039e84373541d6648b76647457be5a7e098

git at public.curoverse.com git at public.curoverse.com
Wed May 7 11:23:38 EDT 2014


Summary of changes:
 sdk/java/ArvadosSDKJavaExample.java |   34 +++++++++-------------------------
 1 files changed, 9 insertions(+), 25 deletions(-)

       via  a3cd0039e84373541d6648b76647457be5a7e098 (commit)
      from  1c6bc4bcac86195a120e6be564703e7d2133dbe7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit a3cd0039e84373541d6648b76647457be5a7e098
Author: radhika <radhika at curoverse.com>
Date:   Wed May 7 11:23:01 2014 -0400

    2525: refactor response printing

diff --git a/sdk/java/ArvadosSDKJavaExample.java b/sdk/java/ArvadosSDKJavaExample.java
index 3c6578c..7c9c013 100644
--- a/sdk/java/ArvadosSDKJavaExample.java
+++ b/sdk/java/ArvadosSDKJavaExample.java
@@ -38,17 +38,7 @@ public class ArvadosSDKJavaExample {
 
     Map response = arv.call("users", "list", params);
     System.out.println("Arvados users.list:\n");
-    Set<Entry<String,Object>> entrySet = (Set<Entry<String,Object>>)response.entrySet();
-    for (Map.Entry<String, Object> entry : entrySet) {
-      if ("items".equals(entry.getKey())) {
-        List items = (List)entry.getValue();
-        for (Object item : items) {
-          System.out.println("    " + item);
-        }            
-      } else {
-        System.out.println(entry.getKey() + " = " + entry.getValue());
-      }
-    }
+    printResponse(response);
     
     // get uuid of the first user from the response
     List items = (List)response.get("items");
@@ -62,17 +52,7 @@ public class ArvadosSDKJavaExample {
     params.put("uuid", userUuid);
     response = arv.call("users", "get", params);
     System.out.println("Arvados users.get:\n");
-    entrySet = (Set<Entry<String,Object>>)response.entrySet();
-    for (Map.Entry<String, Object> entry : entrySet) {
-      if ("items".equals(entry.getKey())) {
-        items = (List)entry.getValue();
-        for (Object item : items) {
-          System.out.println("    " + item);
-        }            
-      } else {
-        System.out.println(entry.getKey() + " = " + entry.getValue());
-      }
-    }
+    printResponse(response);
 
     // Make a pipeline_templates list call
     System.out.println("\n\n\nMaking a pipeline_templates.list call.");
@@ -81,10 +61,14 @@ public class ArvadosSDKJavaExample {
     response = arv.call("pipeline_templates", "list", params);
 
     System.out.println("Arvados pipelinetempates.list:\n");
-    entrySet = (Set<Entry<String,Object>>)response.entrySet();
+    printResponse(response);
+  }
+  
+  private static void printResponse(Map response){
+    Set<Entry<String,Object>> entrySet = (Set<Entry<String,Object>>)response.entrySet();
     for (Map.Entry<String, Object> entry : entrySet) {
       if ("items".equals(entry.getKey())) {
-        items = (List)entry.getValue();
+        List items = (List)entry.getValue();
         for (Object item : items) {
           System.out.println("    " + item);
         }            
@@ -93,4 +77,4 @@ public class ArvadosSDKJavaExample {
       }
     }
   }
-}
+}
\ No newline at end of file

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list