Update published event to include header and body
[aai/gizmo.git] / src / main / java / org / onap / crud / event / response / GraphEventResponseMessage.java
1 /**
2  * ============LICENSE_START=======================================================
3  * Gizmo
4  * ================================================================================
5  * Copyright © 2017 AT&T Intellectual Property.
6  * Copyright © 2017 Amdocs
7  * All rights reserved.
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
12  *
13  *    http://www.apache.org/licenses/LICENSE-2.0
14  *
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=========================================================
21  *
22  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23  */
24 package org.onap.crud.event.response;
25
26 import java.text.MessageFormat;
27
28 /**
29  * Graph event handling messages, including logging and exceptions.
30  */
31 public enum GraphEventResponseMessage {
32
33     //@formatter:off
34     BASE_OPERATION_LOG_MESSAGE("Event response received: {0} with key: {1}, transaction-id: {2}, operation: {3}, result: {4}"),
35     OPERATION_ERROR_LOG_MESSAGE("{0}, error: {1}"),
36     OPERATION_ERROR_EXCEPTION_MESSAGE("Operation Failed with transaction-id: {0}. Error: {1}"),
37     POLICY_VIOLATION_LOG_MESSAGE("Event response received: transaction-id: {0}, event source: {1}, event type: {2}, object key: {3}, object type: {4}, operation: {5}, result: policy violations detected in request, error: {6}"),
38     POLICY_VIOLATION_EXCEPTION_MESSAGE("Operation Failed with transaction-id {0}. Error: policy violations detected in request, {1}");
39     //@formatter:on
40
41     private String message;
42
43     private GraphEventResponseMessage(String message) {
44         this.message = message;
45     }
46
47     /**
48      * @param args to be formatted
49      * @return the formatted error message
50      */
51     public String getMessage(Object... args) {
52         MessageFormat formatter = new MessageFormat("");
53         formatter.applyPattern(this.message);
54         return formatter.format(args);
55     }
56 }