X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fmusic%2Fresponse%2Fjsonobjects%2FJsonResponse.java;h=66fec9c230bcc77b0fef379dc1ec07c85af5a5d2;hb=d6e7b63cc580e7b3822be61fe92a493ad5e222a3;hp=207911d7ef0bc301f0457491ea0fabfac1b7de91;hpb=f2fd25b81e941fdb96091657220b5a3992b02a63;p=music.git diff --git a/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java b/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java index 207911d7..66fec9c2 100644 --- a/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java +++ b/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java @@ -19,12 +19,13 @@ * ============LICENSE_END============================================= * ==================================================================== */ + package org.onap.music.response.jsonobjects; import java.util.HashMap; import java.util.Map; -import org.onap.music.lockingservice.MusicLockState.LockStatus; +import org.onap.music.lockingservice.cassandra.MusicLockState.LockStatus; import org.onap.music.main.ResultType; @@ -34,7 +35,7 @@ import io.swagger.annotations.ApiModelProperty; @ApiModel(value = "JsonResponse", description = "General Response JSON") public class JsonResponse { - /* Status is required */ + /* Status is required */ private ResultType status; /* Standard informational fields */ @@ -43,6 +44,7 @@ public class JsonResponse { /* versioning */ private String musicVersion; + private String musicBuild; /* Data Fields */ private Map> dataResult; @@ -64,7 +66,7 @@ public class JsonResponse { this.status = status; } - /** + /** * * @return */ @@ -121,33 +123,52 @@ public class JsonResponse { /** - * + * . * @return the music version */ public String getMusicVersion() { - return this.musicVersion; + return this.musicVersion; } /** - * + * . * @param version of music * @return */ public JsonResponse setMusicVersion(String version) { - this.musicVersion = version; - return this; + this.musicVersion = version; + return this; } + /** + * . + * @return the music version + */ + public String getMusicBuild() { + return this.musicBuild; + } + + /** + * . + * @param build of music + * @return + */ + public JsonResponse setMusicBuild(String build) { + this.musicBuild = build; + return this; + } + + public Map> getDataResult() { - return this.dataResult; + return this.dataResult; } public JsonResponse setDataResult(Map> map) { - this.dataResult = map; - return this; + this.dataResult = map; + return this; } - /** + /** * * @return */ @@ -226,36 +247,40 @@ public class JsonResponse { public Map toMap() { Map fullMap = new HashMap<>(); fullMap.put("status", status); - if (error!=null) { - fullMap.put("error", error); + if (error != null && !"".equals(error)) { + fullMap.put("error", error); } - if (message!=null) { - fullMap.put("message", message); + if (message != null) { + fullMap.put("message", message); } - if (musicVersion!=null) { + if (musicVersion != null) { fullMap.put("version", musicVersion); } - if (dataResult!=null) { - fullMap.put("result", dataResult); + if (musicBuild != null) { + fullMap.put("build", musicBuild); + } + + if (dataResult != null) { + fullMap.put("result", dataResult); } - if (lock!=null) { - Map lockMap = new HashMap<>(); - if (lock!=null) { - lockMap.put("lock", lock); - } - if (lockStatus!=null) { - lockMap.put("lock-status", lockStatus); - } - if (lockHolder!=null) { - lockMap.put("lock-holder", lockHolder); - } - if (lockLease!=null) { - lockMap.put("lock-lease", lockLease); - } - fullMap.put("lock", lockMap); + if (lock != null) { + Map lockMap = new HashMap<>(); + if (lock != null) { + lockMap.put("lock", lock); + } + if (lockStatus != null) { + lockMap.put("lock-status", lockStatus); + } + if (lockHolder != null) { + lockMap.put("lock-holder", lockHolder); + } + if (lockLease != null) { + lockMap.put("lock-lease", lockLease); + } + fullMap.put("lock", lockMap); } return fullMap;