Change nexus values to properties
[appc.git] / appc-event-listener / appc-event-listener-bundle / src / main / java / org / openecomp / appc / listener / CL / model / CommonMessage.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * openECOMP : APP-C
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights
6  *                                              reserved.
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
11  * 
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  * 
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=========================================================
20  */
21
22 package org.openecomp.appc.listener.CL.model;
23
24 import java.io.Serializable;
25
26 import org.json.JSONObject;
27 import org.openecomp.appc.listener.util.Mapper;
28
29 import com.fasterxml.jackson.annotation.JsonIgnore;
30 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
31 import com.fasterxml.jackson.annotation.JsonProperty;
32 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
33 import com.fasterxml.jackson.databind.annotation.JsonSerialize.Inclusion;
34
35 /**
36  * This class holds attributes that are common to DMaaP messages both coming in from DCAE and being sent out by APPC
37  *
38  */
39 @JsonSerialize(include = Inclusion.NON_NULL)
40 @JsonIgnoreProperties(ignoreUnknown = true)
41 public class CommonMessage implements Serializable {
42
43     private static final long serialVersionUID = 1L;
44
45     /*
46      * The unique id of the event as of 1602
47      */
48     @JsonProperty("eventID")
49     private String id;
50
51     /*
52      * The time that the request was sent out.
53      */
54     @JsonProperty("requestTime")
55     private String requestTime;
56
57     /*
58      * The originator of the event
59      */
60     @JsonProperty("requestClient")
61     private String requestClient;
62
63     /*
64      * The system that sent the message
65      */
66     @JsonProperty("from")
67     private String fromSystem;
68
69     /*
70      * The actual trap message
71      */
72     @JsonProperty("message")
73     private String message;
74
75     /*
76      * The vm name associated with the event
77      */
78     @JsonProperty("VMName")
79     private String vmName;
80
81     /*
82      * The policy name on the incoming event
83      */
84     @JsonProperty("policyName")
85     private String policyName;
86
87     /*
88      * The policy version on the incoming event
89      */
90     @JsonProperty("policyVersion")
91     private String policyVersion;
92
93     @JsonIgnore
94     private long startTime = System.currentTimeMillis();
95
96     /*
97      * Getters and Setters
98      */
99
100     public String getId() {
101         return id;
102     }
103
104     public String getRequestTime() {
105         return requestTime;
106     }
107
108     public String getRequestClient() {
109         return requestClient;
110     }
111
112     public String getFromSystem() {
113         return fromSystem;
114     }
115
116     public String getMessage() {
117         return message;
118     }
119
120     public String getPolicyName() {
121         return policyName;
122     }
123
124     public String getPolicyVersion() {
125         return policyVersion;
126     }
127
128     public String getVmName() {
129         return vmName;
130     }
131
132     public long getStartTime() {
133         return startTime;
134     }
135
136     public void setId(String eventId) {
137         id = eventId;
138     }
139
140     public void setRequestTime(String requestTime) {
141         this.requestTime = requestTime;
142     }
143
144     public void setRequestClient(String requestClient) {
145         this.requestClient = requestClient;
146     }
147
148     public void setFromSystem(String fromSystem) {
149         this.fromSystem = fromSystem;
150     }
151
152     public void setMessage(String message) {
153         this.message = message;
154     }
155
156     public void setPolicyName(String name) {
157         policyName = name;
158     }
159
160     public void setPolicyVersion(String version) {
161         policyVersion = version;
162     }
163
164     public void setVmName(String vmName) {
165         this.vmName = vmName;
166     }
167
168     public void setStartTime(long startTime) {
169         this.startTime = startTime;
170     }
171
172     /**
173      * Convenience method to return a json representation of this object.
174      * 
175      * @return The json representation of this object
176      */
177     public JSONObject toJson() {
178         return Mapper.toJsonObject(this);
179     }
180
181 }