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.errors;
24 import javax.ws.rs.core.Response;
27 * This class represents an error object to be returned in failed REST instead of just returning one
28 * of HTTP fail statuses.
30 public class ErrorCodeAndMessage {
33 * the HTTP status code.
35 private Response.Status status;
38 * Error code no. if available.
40 private String errorCode;
43 * the error message to be displayed.
45 private String message;
47 public ErrorCodeAndMessage() {
51 * Instantiates a new Error code and message.
53 * @param status the status
54 * @param errorCode the error code
56 public ErrorCodeAndMessage(Response.Status status, ErrorCode errorCode) {
58 this.message = errorCode.message();
59 this.errorCode = errorCode.id();
63 public Response.Status getStatus() {
67 public void setStatus(Response.Status status) {
71 public String getErrorCode() {
75 public void setErrorCode(String errorCode) {
76 this.errorCode = errorCode;
79 public String getMessage() {
83 public void setMessage(String message) {
84 this.message = message;