2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2019 Nordix Foundation.
7 * Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd.
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
23 package org.onap.policy.appclcm;
25 import java.io.Serializable;
26 import org.onap.policy.appclcm.util.StatusCodeEnum;
28 public class LcmResponseCode implements Serializable {
30 /* These fields define the key to the response code value. */
31 public static final String ACCEPTED = "ACCEPTED";
32 public static final String ERROR = "ERROR";
33 public static final String REJECT = "REJECT";
34 public static final String SUCCESS = "SUCCESS";
35 public static final String FAILURE = "FAILURE";
36 public static final String PARTIAL_SUCCESS = "PARTIAL SUCCESS";
37 public static final String PARTIAL_FAILURE = "PARTIAL FAILURE";
38 private static final long serialVersionUID = 8189456447227022582L;
40 private final Integer code;
42 protected LcmResponseCode(final int code) {
46 public int getCode() {
51 public String toString() {
52 return Integer.toString(this.code);
56 * Translates the code to a string value that represents the meaning of the code.
58 * @param code the numeric value that is returned by APPC based on success, failure, etc. of the action requested
59 * @return the string value equivalent of the APPC response code
61 public static String toResponseValue(int code) {
62 StatusCodeEnum statusCodeEnum = StatusCodeEnum.fromStatusCode(code);
63 return (statusCodeEnum != null) ? statusCodeEnum.toString() : null;