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.ci.tests.datatypes.enums;
23 public class ErrorInfo {
26 private String message;
27 private String messageId;
31 // TODO Auto-generated constructor stub
34 public ErrorInfo(Integer code, String message, String messageId) {
37 this.message = message;
38 this.messageId = messageId;
41 public ErrorInfo(Integer code, String message) {
44 this.message = message;
47 public Integer getCode() {
51 public void setCode(Integer code) {
55 public String getMessage() {
59 public String getMessageAndReplaceVariables(Object... variables) {
60 String formatReadyString = message.replaceAll("%[\\d]+", "%s");
61 formatReadyString = String.format(formatReadyString, variables);
62 return formatReadyString;
65 public String getAuditDesc(Object... variables) {
66 String messageAndReplaceVariables = getMessageAndReplaceVariables(variables);
68 if (messageId != null) {
69 res = messageId + ": " + messageAndReplaceVariables;
71 res = messageAndReplaceVariables;
76 public void setMessage(String message) {
77 this.message = message;
80 public String getMessageId() {
84 public void setMessageId(String messageId) {
85 this.messageId = messageId;
89 public String toString() {
90 return "ErrorInfo [code=" + code + ", message=" + message + ", messageId=" + messageId + "]";