2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.common.api;
23 import com.fasterxml.jackson.core.JsonProcessingException;
24 import com.fasterxml.jackson.databind.ObjectMapper;
26 public class ResponseInfo {
28 public enum ResponseStatusEnum {
29 SUCCESS("success"), LOGIN_FAILED("loginFailed"), INTERNAL_ERROR("internalError"), MISSING_HEADERS("required headers are missing"), TIMEOUT("timeout"), PARSING_ERROR("parsingFailed");
31 private String statusDescription;
33 ResponseStatusEnum(String status) {
34 this.statusDescription = status;
37 public String getStatusDescription() {
38 return statusDescription;
42 private ResponseStatusEnum applicativeStatus;
43 private String description;
45 public ResponseInfo(ResponseStatusEnum applicativeStatus, String description) {
47 this.applicativeStatus = applicativeStatus;
48 this.description = description;
51 public ResponseInfo(ResponseStatusEnum applicativeStatus) {
53 this.applicativeStatus = applicativeStatus;
56 public ResponseStatusEnum getApplicativeStatus() {
57 return applicativeStatus;
60 public void setApplicativeStatus(ResponseStatusEnum applicativeStatus) {
61 this.applicativeStatus = applicativeStatus;
64 public String getDescription() {
68 public void setDescription(String description) {
69 this.description = description;
73 public String toString() {
74 ObjectMapper mapper = new ObjectMapper();
75 String tostring = super.toString();
77 tostring = mapper.writeValueAsString(this);
78 } catch (JsonProcessingException e) {