2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.openecomp.appc.oam;
25 import org.openecomp.appc.executor.objects.Params;
26 import org.openecomp.appc.util.MessageFormatter;
30 public enum OAMCommandStatus {
32 ACCEPTED(100,"ACCEPTED - request accepted"),
34 //ERROR(2xx) – request can’t be handled due to some technical error
35 UNEXPECTED_ERROR(200,"UNEXPECTED ERROR - ${errorMsg}"),
37 SUCCESS(400,"SUCCESS - request has been processed successfully"),
41 public static final String errorDgMessageParamName = "errorDgMessage";
43 private int responseCode;
44 private String responseMessage;
49 OAMCommandStatus(int responseCode, String responseMessage) {
50 this.responseCode = responseCode;
51 this.responseMessage = responseMessage;
54 public String getResponseMessage() {
55 return responseMessage;
58 public int getResponseCode() {
65 * @return messageTemplate
69 public String getFormattedMessage(Params params){
70 Map<String,Object> paramsMap = params != null ? params.getParams() : null;
71 return MessageFormatter.format(getResponseMessage(),paramsMap);
75 public String getFormattedMessageWithCode(Params params){
76 return getResponseCode()+"-" + getFormattedMessage(params);
80 public String toString() {
81 return "OAMCommandStatus{" +
82 "responseCode=" + responseCode +
83 ", responseMessage='" + responseMessage + '\'' +