b7933184cf031709684ffff9623c18a8e7e77ce7
[appc.git] / services / appc-dmaap-service / appc-event-listener-bundle / src / main / java / org / onap / appc / listener / LCM / model / CommonHeader.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * =============================================================================
9  * Modification Copyright (C) 2019 IBM
10  * =============================================================================
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  * 
15  *      http://www.apache.org/licenses/LICENSE-2.0
16  * 
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  * 
23  * ============LICENSE_END=========================================================
24  */
25
26 package org.onap.appc.listener.LCM.model;
27
28 import com.fasterxml.jackson.annotation.JsonProperty;
29
30 import java.io.Serializable;
31 import java.text.DateFormat;
32 import java.text.SimpleDateFormat;
33 import java.util.Map;
34
35 import org.onap.appc.util.Time;
36
37 public class CommonHeader implements Serializable {
38     @JsonProperty("timestamp")
39     private String timeStamp;
40     @JsonProperty("api-ver")
41     private String apiVer;
42     @JsonProperty("originator-id")
43     private String originatorId;
44     @JsonProperty("request-id")
45     private String requestID;
46     @JsonProperty("sub-request-id")
47     private String subRequestId;
48     @JsonProperty("flags")
49     private Map<String, String> flags;
50
51     private final DateFormat ZULU_FORMATTER = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS'Z'");
52
53     public CommonHeader() {
54     }
55
56     public CommonHeader(CommonHeader commonHeader) {
57         // changed to current system time
58         timeStamp = ZULU_FORMATTER.format(Time.utcDate());
59
60         apiVer = commonHeader.getApiVer();
61         originatorId = commonHeader.getOriginatorId();
62         requestID = commonHeader.getRequestID();
63         subRequestId = commonHeader.getSubRequestId();
64         flags = commonHeader.getFlags();
65     }
66
67
68
69     public String getTimeStamp() {
70         return timeStamp;
71     }
72
73     public void setTimeStamp(String timeStamp) {
74         this.timeStamp = timeStamp;
75     }
76
77     public String getApiVer() {
78         return apiVer;
79     }
80
81     public void setApiVer(String apiVer) {
82         this.apiVer = apiVer;
83     }
84
85     public String getRequestID() {
86         return requestID;
87     }
88
89     public void setRequestID(String requestID) {
90         this.requestID = requestID;
91     }
92
93     public String getOriginatorId() {
94         return originatorId;
95     }
96
97     public void setOriginatorId(String originatorId) {
98         this.originatorId = originatorId;
99     }
100
101     public String getSubRequestId() {
102         return subRequestId;
103     }
104
105     public void setSubRequestId(String subRequestId) {
106         this.subRequestId = subRequestId;
107     }
108
109     public Map<String, String> getFlags() {
110         return flags;
111     }
112
113     public void setFlags(Map<String, String> flags) {
114         this.flags = flags;
115     }
116 }