2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2017 Amdocs
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.
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 * ============LICENSE_END=========================================================
25 package org.onap.appc.adapter.message.event;
27 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
28 import com.fasterxml.jackson.annotation.JsonProperty;
29 import com.fasterxml.jackson.databind.ObjectMapper;
30 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
31 import com.fasterxml.jackson.databind.annotation.JsonSerialize.Inclusion;
33 import java.io.IOException;
34 import java.io.Serializable;
39 "eventTime": "2016-03-15T10:59:33.79Z",
41 "EventId": "<ECOMP_EVENT_ID>",
51 @JsonSerialize(include = Inclusion.NON_NULL)
52 @JsonIgnoreProperties(ignoreUnknown = true)
53 public class EventMessage implements Serializable {
55 private static final long serialVersionUID = 1L;
57 private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
59 @JsonProperty("eventHeader")
60 private EventHeader eventHeader;
61 @JsonProperty("eventStatus")
62 private EventStatus eventStatus;
64 public EventMessage(EventHeader eventHeader, EventStatus eventStatus) {
65 this.eventHeader = eventHeader;
66 this.eventStatus = eventStatus;
69 public EventHeader getEventHeader() {
73 public void setEventHeader(EventHeader eventHeader) {
74 this.eventHeader = eventHeader;
77 public EventStatus getEventStatus() {
81 public void setEventStatus(EventStatus eventStatus) {
82 this.eventStatus = eventStatus;
85 public String toJson() {
87 return OBJECT_MAPPER.writeValueAsString(this);
88 } catch (IOException e) {
89 throw new RuntimeException(e);
94 public String toString() {
95 return "EventMessage{" +
96 "eventHeader=" + eventHeader +
97 ", eventStatus=" + eventStatus +