d60adc1dac42a0ada3d48a1501cc19cdfe7ca0ef
[appc.git] / appc-event-listener / 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  * 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  * 
21  * ============LICENSE_END=========================================================
22  */
23
24 package org.onap.appc.listener.LCM.model;
25
26 import com.fasterxml.jackson.annotation.JsonProperty;
27
28 import java.io.Serializable;
29 import java.text.DateFormat;
30 import java.text.SimpleDateFormat;
31 import java.util.Map;
32
33 import org.onap.appc.util.Time;
34
35 public class CommonHeader implements Serializable {
36     @JsonProperty("timestamp")
37     private String timeStamp;
38     @JsonProperty("api-ver")
39     private String apiVer;
40     @JsonProperty("originator-id")
41     private String originatorId;
42     @JsonProperty("request-id")
43     private String requestID;
44     @JsonProperty("sub-request-id")
45     private String subRequestId;
46     @JsonProperty("flags")
47     private Map<String, String> flags;
48
49     private static final DateFormat ZULU_FORMATTER = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SS'Z'");
50
51     public CommonHeader() {
52     }
53
54     public CommonHeader(CommonHeader commonHeader) {
55         // changed to current system time
56         timeStamp = ZULU_FORMATTER.format(Time.utcDate());
57
58         apiVer = commonHeader.getApiVer();
59         originatorId = commonHeader.getOriginatorId();
60         requestID = commonHeader.getRequestID();
61         subRequestId = commonHeader.getSubRequestId();
62         flags = commonHeader.getFlags();
63     }
64
65
66
67     public String getTimeStamp() {
68         return timeStamp;
69     }
70
71     public void setTimeStamp(String timeStamp) {
72         this.timeStamp = timeStamp;
73     }
74
75     public String getApiVer() {
76         return apiVer;
77     }
78
79     public void setApiVer(String apiVer) {
80         this.apiVer = apiVer;
81     }
82
83     public String getRequestID() {
84         return requestID;
85     }
86
87     public void setRequestID(String requestID) {
88         this.requestID = requestID;
89     }
90
91     public String getOriginatorId() {
92         return originatorId;
93     }
94
95     public void setOriginatorId(String originatorId) {
96         this.originatorId = originatorId;
97     }
98
99     public String getSubRequestId() {
100         return subRequestId;
101     }
102
103     public void setSubRequestId(String subRequestId) {
104         this.subRequestId = subRequestId;
105     }
106
107     public Map<String, String> getFlags() {
108         return flags;
109     }
110
111     public void setFlags(Map<String, String> flags) {
112         this.flags = flags;
113     }
114 }