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