2 * ============LICENSE_START=======================================================
3 * ONAP Policy Decision Models
4 * ================================================================================
5 * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.models.decisions.concepts;
23 import com.google.gson.annotations.SerializedName;
24 import java.time.LocalDate;
25 import java.time.OffsetDateTime;
26 import java.time.OffsetTime;
27 import java.time.ZoneOffset;
28 import java.util.HashMap;
31 import lombok.NoArgsConstructor;
34 * This class is for a Decision Request to a Decision PDP Engine.
36 * @author pameladragosh
41 public class DecisionRequest {
42 @SerializedName("ONAPName")
43 private String onapName;
45 @SerializedName("ONAPComponent")
46 private String onapComponent;
48 @SerializedName("ONAPInstance")
49 private String onapInstance;
51 @SerializedName("requestId")
52 private String requestId;
54 @SerializedName("context")
55 private Map<String, Object> context;
57 @SerializedName("action")
58 private String action;
60 @SerializedName("currentDateTime")
61 private OffsetDateTime currentDateTime;
63 @SerializedName("currentDate")
64 private LocalDate currentDate;
66 @SerializedName("currentTime")
67 private OffsetTime currentTime;
69 @SerializedName("timeZone")
70 private ZoneOffset timeZone;
72 @SerializedName("resource")
73 private Map<String, Object> resource;
78 * @param request Incoming DecisionRequest
80 public DecisionRequest(DecisionRequest request) {
81 this.setOnapName(request.getOnapName());
82 this.setOnapComponent(request.getOnapComponent());
83 this.setOnapInstance(request.getOnapInstance());
84 this.setRequestId(request.getRequestId());
85 if (request.getContext() != null) {
86 this.setContext(new HashMap<>());
87 this.getContext().putAll(request.getContext());
89 this.setAction(request.getAction());
90 this.setCurrentDate(request.getCurrentDate());
91 this.setCurrentDateTime(request.getCurrentDateTime());
92 this.setCurrentTime(request.getCurrentTime());
93 this.setTimeZone(request.getTimeZone());
94 if (request.getResource() != null) {
95 this.setResource(new HashMap<>());
96 this.getResource().putAll(request.getResource());