Remove dmaap from models
[policy/models.git] / models-interactions / model-impl / appclcm / src / main / java / org / onap / policy / appclcm / AppcLcmCommonHeader.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * appclcm
4  * ================================================================================
5  * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
6  * Modifications Copyright (C) 2019 Nordix Foundation.
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.onap.policy.appclcm;
23
24 import com.google.gson.annotations.SerializedName;
25 import java.io.Serializable;
26 import java.time.Instant;
27 import java.util.HashMap;
28 import java.util.Map;
29 import java.util.UUID;
30 import lombok.Data;
31 import lombok.NoArgsConstructor;
32 import lombok.NonNull;
33 import lombok.RequiredArgsConstructor;
34
35 @NoArgsConstructor
36 @RequiredArgsConstructor
37 @Data
38 public class AppcLcmCommonHeader implements Serializable {
39
40     private static final long serialVersionUID = 6581963539127062114L;
41
42     @SerializedName(value = "timestamp")
43     private Instant timeStamp = Instant.now();
44
45     @SerializedName(value = "api-ver")
46     private String apiVer = "2.00";
47
48     @NonNull
49     @SerializedName(value = "originator-id")
50     private String originatorId;
51
52     @NonNull
53     @SerializedName(value = "request-id")
54     private UUID requestId;
55
56     @NonNull
57     @SerializedName(value = "sub-request-id")
58     private String subRequestId;
59
60     @SerializedName(value = "flags")
61     private Map<String, String> flags = new HashMap<>();
62
63     /**
64      * Used to copy a common header.
65      *
66      * @param commonHeader a header that is defined by the lcm api guide that contains information
67      *        about the request (requestId, flags, etc.)
68      */
69     public AppcLcmCommonHeader(AppcLcmCommonHeader commonHeader) {
70         this.originatorId = commonHeader.originatorId;
71         this.requestId = commonHeader.requestId;
72         this.subRequestId = commonHeader.subRequestId;
73         this.timeStamp = commonHeader.timeStamp;
74         if (commonHeader.flags != null) {
75             this.flags.putAll(commonHeader.flags);
76         }
77     }
78
79 }