2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2019 Nordix Foundation.
7 * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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 * ============LICENSE_END=========================================================
23 package org.onap.policy.sdnr;
25 import com.google.gson.annotations.SerializedName;
26 import java.io.Serializable;
27 import java.time.Instant;
28 import java.util.HashMap;
30 import java.util.UUID;
31 import lombok.EqualsAndHashCode;
38 public class PciCommonHeader implements Serializable {
40 private static final long serialVersionUID = 5435363539127062114L;
42 @SerializedName(value = "TimeStamp")
43 private Instant timeStamp = Instant.now();
45 @SerializedName(value = "APIVer")
46 private String apiVer = "1.0";
48 @SerializedName(value = "RequestID")
49 private UUID requestId;
51 @SerializedName(value = "SubRequestID")
52 private String subRequestId;
54 @SerializedName(value = "RequestTrack")
55 private Map<String, String> requestTrack = new HashMap<>();
57 @SerializedName(value = "Flags")
58 private Map<String, String> flags = new HashMap<>();
60 public PciCommonHeader() {
65 * Used to copy a pci common header.
67 * @param commonHeader a header that is defined by the Pci api guide that contains information
68 * about the request (requestId, flags, etc.)
70 public PciCommonHeader(PciCommonHeader commonHeader) {
71 this.timeStamp = commonHeader.timeStamp;
72 this.requestId = commonHeader.requestId;
73 this.subRequestId = commonHeader.subRequestId;
74 this.apiVer = commonHeader.getApiVer();
75 if (commonHeader.requestTrack != null) {
76 this.requestTrack.putAll(commonHeader.requestTrack);
78 if (commonHeader.flags != null) {
79 this.flags.putAll(commonHeader.flags);
84 public String toString() {
85 return "CommonHeader [timeStamp=" + timeStamp + ", apiVer=" + apiVer
86 + ", requestId=" + requestId + ", subRequestId=" + subRequestId + ", requestTrack=" + requestTrack
87 + ", flags=" + flags + "]";