aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/music/response
diff options
context:
space:
mode:
authorarthurdent3 <tn1381@att.com>2018-02-02 21:19:53 -0500
committerarthurdent3 <tn1381@att.com>2018-02-05 10:20:49 -0500
commite99b7fa829bf957c2a46223a1a20a32aebeda91b (patch)
tree59ea8681b4165df7fb2482af3f6d411115e32f5a /src/main/java/org/onap/music/response
parentd221feba08b6ad24e7d232247306f7b67934941d (diff)
Initial code Import.
Issue-ID: MUSIC-21 Change-Id: I89ceab0891b4b7cb999dab532d6bae9092f027cc Signed-off-by: arthurdent3 <tn1381@att.com>
Diffstat (limited to 'src/main/java/org/onap/music/response')
-rw-r--r--src/main/java/org/onap/music/response/jsonobjects/JsonLockResponse.java258
-rw-r--r--src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java95
2 files changed, 353 insertions, 0 deletions
diff --git a/src/main/java/org/onap/music/response/jsonobjects/JsonLockResponse.java b/src/main/java/org/onap/music/response/jsonobjects/JsonLockResponse.java
new file mode 100644
index 00000000..875fbbba
--- /dev/null
+++ b/src/main/java/org/onap/music/response/jsonobjects/JsonLockResponse.java
@@ -0,0 +1,258 @@
+/*
+ * ============LICENSE_START==========================================
+ * org.onap.music
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property
+ * ===================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END=============================================
+ * ====================================================================
+ */
+package org.onap.music.response.jsonobjects;
+
+import java.util.HashMap;
+import java.util.Map;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel(value = "JsonResponse", description = "General Response JSON")
+public class JsonLockResponse {
+
+ private String status = "";
+ private String error = "";
+ private String message = "";
+ private String lock = "";
+ private String lockStatus = "";
+ private String lockHolder = "";
+ private String lockLease = "";
+
+ /**
+ *
+ * @param status
+ * @param error
+ * @param lock
+ */
+ public JsonLockResponse(String status, String error, String lock) {
+ this.status = fixStatus(status);
+ this.error = error;
+ this.lock = lock;
+ }
+
+ /**
+ *
+ * @param status
+ * @param error
+ * @param lock
+ * @param lockStatus
+ * @param lockHolder
+ */
+ public JsonLockResponse(String status, String error, String lock, String lockStatus,
+ String lockHolder) {
+ this.status = fixStatus(status);
+ this.error = error;
+ this.lock = lock;
+ this.lockStatus = lockStatus;
+ this.lockHolder = lockHolder;
+ }
+
+ /**
+ *
+ * @param status
+ * @param error
+ * @param lock
+ * @param lockStatus
+ * @param lockHolder
+ * @param lockLease
+ */
+ public JsonLockResponse(String status, String error, String lock, String lockStatus,
+ String lockHolder, String lockLease) {
+ this.status = fixStatus(status);
+ this.error = error;
+ this.lock = lock;
+ this.lockStatus = lockStatus;
+ this.lockHolder = lockHolder;
+ }
+
+
+ /**
+ * Lock
+ *
+ * @return
+ */
+ public String getLock() {
+ return lock;
+ }
+
+ /**
+ *
+ * @param lock
+ */
+ public void setLock(String lock) {
+ this.lock = lock;
+ }
+
+ /**
+ *
+ */
+ public JsonLockResponse() {
+ this.status = "";
+ this.error = "";
+ }
+
+ /**
+ *
+ * @param statusIn
+ * @return
+ */
+ private String fixStatus(String statusIn) {
+ if (statusIn.equalsIgnoreCase("false")) {
+ return "FAILURE";
+ }
+ return "SUCCESS";
+ }
+
+ /**
+ *
+ * @return
+ */
+ @ApiModelProperty(value = "Overall status of the response.",
+ allowableValues = "Success,Failure")
+ public String getStatus() {
+ return status;
+ }
+
+ /**
+ *
+ * @param status
+ */
+ public void setStatus(String status) {
+ this.status = fixStatus(status);
+ }
+
+ /**
+ *
+ * @return the error
+ */
+ @ApiModelProperty(value = "Error value")
+ public String getError() {
+ return error;
+ }
+
+ /**
+ *
+ * @param error
+ */
+ public void setError(String error) {
+ this.error = error;
+ }
+
+ /**
+ *
+ * @return the message
+ */
+ @ApiModelProperty(value = "Message if any need to be conveyed about the lock")
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ *
+ * @param message
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ /**
+ *
+ * @return the lockStatus
+ */
+ @ApiModelProperty(value = "Status of the lock",
+ allowableValues = "UNLOCKED,BEING_LOCKED,LOCKED")
+ public String getLockStatus() {
+ return lockStatus;
+ }
+
+ /**
+ *
+ * @param lockStatus
+ */
+ public void setLockStatus(String lockStatus) {
+ this.lockStatus = lockStatus;
+ }
+
+ /**
+ *
+ *
+ * @return the lockHolder
+ */
+ @ApiModelProperty(value = "Holder of the Lock")
+ public String getLockHolder() {
+ return lockHolder;
+ }
+
+ /**
+ *
+ * @param lockHolder
+ */
+ public void setLockHolder(String lockHolder) {
+ this.lockHolder = lockHolder;
+ }
+
+
+
+ /**
+ * @return the lockLease
+ */
+ public String getLockLease() {
+ return lockLease;
+ }
+
+ /**
+ * @param lockLease the lockLease to set
+ */
+ public void setLockLease(String lockLease) {
+ this.lockLease = lockLease;
+ }
+
+ /**
+ * Convert to Map
+ *
+ * @return
+ */
+ public Map<String, Object> toMap() {
+ Map<String, Object> newMap = new HashMap<>();
+ Map<String, Object> lockMap = new HashMap<>();
+ lockMap.put("lock-status", lockStatus);
+ lockMap.put("lock", lock);
+ lockMap.put("message", message);
+ lockMap.put("lock-holder", lockHolder);
+ lockMap.put("lock-lease", lockLease);
+ newMap.put("status", status);
+ newMap.put("error", error);
+ newMap.put("lock", lockMap);
+ return newMap;
+ }
+
+ /**
+ * Convert to String
+ */
+ @Override
+ public String toString() {
+ return "JsonLockResponse [status=" + status + ", error=" + error + ", message=" + message
+ + ", lock=" + lock + ", lockStatus=" + lockStatus + ", lockHolder="
+ + lockHolder + "]";
+ }
+
+}
diff --git a/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java b/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java
new file mode 100644
index 00000000..d44f9fe7
--- /dev/null
+++ b/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java
@@ -0,0 +1,95 @@
+/*
+ * ============LICENSE_START==========================================
+ * org.onap.music
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property
+ * ===================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ============LICENSE_END=============================================
+ * ====================================================================
+ */
+package org.onap.music.response.jsonobjects;
+
+
+import java.util.HashMap;
+import java.util.Map;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel(value = "JsonResponse", description = "General Response JSON")
+public class JsonResponse {
+
+ private Boolean status = false;
+ private String error = "";
+ private String version = "";
+
+ public JsonResponse(Boolean status, String error, String version) {
+ this.status = status;
+ this.error = error;
+ this.version = version;
+ }
+
+ public JsonResponse() {
+ this.status = false;
+ this.error = "";
+ this.version = "";
+ }
+
+ @ApiModelProperty(value = "Status value")
+ public Boolean getStatus() {
+ return status;
+ }
+
+ /**
+ *
+ * @param statusIn
+ * @return
+ */
+ private String fixStatus(String statusIn) {
+ if (statusIn.equalsIgnoreCase("false")) {
+ return "FAILURE";
+ }
+ return "SUCCESS";
+ }
+
+ public void setStatus(Boolean status) {
+ this.status = status;
+ }
+
+ @ApiModelProperty(value = "Error value")
+ public String getError() {
+ return error;
+ }
+
+ public void setError(String error) {
+ this.error = error;
+ }
+
+ @ApiModelProperty(value = "Version value")
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public Map<String, Object> toMap() {
+ Map<String, Object> newMap = new HashMap<>();
+ newMap.put("status", fixStatus(String.valueOf(status)));
+ newMap.put("error", error);
+ newMap.put("version", version);
+ return newMap;
+ }
+}