summaryrefslogtreecommitdiffstats
path: root/sms-client
diff options
context:
space:
mode:
Diffstat (limited to 'sms-client')
-rw-r--r--sms-client/src/java/example/SmsClientExample.java3
-rw-r--r--sms-client/src/java/main/SmsClient.java26
2 files changed, 26 insertions, 3 deletions
diff --git a/sms-client/src/java/example/SmsClientExample.java b/sms-client/src/java/example/SmsClientExample.java
index 7bbaa90..dc0e776 100644
--- a/sms-client/src/java/example/SmsClientExample.java
+++ b/sms-client/src/java/example/SmsClientExample.java
@@ -103,6 +103,9 @@ public class SmsClientExample {
}
SmsResponse resp6= sms.getSecret("onap.new.test.sms0", "credentials");
if ( resp6.getSuccess() ) {
+ Boolean b = (Boolean)resp6.getResponse().get("isadmin");
+ if ( b )
+ System.out.println("Age=" + (Integer)resp6.getResponse().get("age"));
System.out.println(resp6.getResponse());
System.out.println(resp6.getResponseCode());
}
diff --git a/sms-client/src/java/main/SmsClient.java b/sms-client/src/java/main/SmsClient.java
index 69d81e4..ce48f72 100644
--- a/sms-client/src/java/main/SmsClient.java
+++ b/sms-client/src/java/main/SmsClient.java
@@ -48,6 +48,17 @@ public class SmsClient implements SmsInterface {
ssf = s;
}
+ private Map<String, Object> getSubmap(Map<String, Object> raw, String k) {
+ Object v = raw.get(k);
+ if ( v != null ) {
+ Map<String, Object> r = (Map<String, Object>)v;
+ return(r);
+ }
+ else {
+ return(null);
+ }
+ }
+
private List<Object> jsontolist(JSONArray a) throws JSONException {
List<Object> l = new ArrayList<Object>();
for(int i=0;i<a.length();i++) {
@@ -210,10 +221,19 @@ public class SmsClient implements SmsInterface {
SmsResponse resp = execute("GET", t, null, false, true);
int errcode = resp.getResponseCode();
- if ( errcode > 0 && errcode/100 == 2 )
- resp.setSuccess(true);
- else
+ if ( errcode > 0 && errcode/100 == 2 ) {
+ Map<String, Object> m = getSubmap(resp.getResponse(), "values");
+ if ( m != null ) {
+ resp.setSuccess(true);
+ resp.setResponse(m);
+ }
+ else {
+ resp.setSuccess(false);
+ }
+ }
+ else {
resp.setSuccess(false);
+ }
return(resp);