X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/8fcba3783d9a79bb18a00d339f9b3222f1eccd7f..5fb73e1dcad7e3179ab74623e88bc672353a84ed:/sdk/java/ArvadosSDKJavaExample.java diff --git a/sdk/java/ArvadosSDKJavaExample.java b/sdk/java/ArvadosSDKJavaExample.java index 3c6578ca33..7c9c0138ea 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> entrySet = (Set>)response.entrySet(); - for (Map.Entry 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>)response.entrySet(); - for (Map.Entry 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>)response.entrySet(); + printResponse(response); + } + + private static void printResponse(Map response){ + Set> entrySet = (Set>)response.entrySet(); for (Map.Entry 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