From a70dbf38827f6c3b50f35c947faa81985711e242 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Mon, 16 Dec 2019 11:11:05 -0500 Subject: Modifications to decision request and policy fixes Discovered while working on both the SDNC naming and optimization application work. Fixed the datatype for SDNC naming policy type Added a copy constructor for Decision request Added metadata for optimization Subscriber policy type Issue-ID: POLICY-2066 Change-Id: I83c99533f26747c856c591d05d22691714549cf2 Signed-off-by: Pamela Dragosh --- .../models/decisions/concepts/DecisionRequest.java | 29 ++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'models-decisions/src/main') diff --git a/models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionRequest.java b/models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionRequest.java index 1ba7f4362..ca1e9e207 100644 --- a/models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionRequest.java +++ b/models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionRequest.java @@ -21,10 +21,10 @@ package org.onap.policy.models.decisions.concepts; import com.google.gson.annotations.SerializedName; - +import java.util.HashMap; import java.util.Map; - import lombok.Data; +import lombok.NoArgsConstructor; /** * This class is for a Decision Request to a Decision PDP Engine. @@ -33,6 +33,7 @@ import lombok.Data; * */ @Data +@NoArgsConstructor public class DecisionRequest { @SerializedName("ONAPName") private String onapName; @@ -46,9 +47,33 @@ public class DecisionRequest { @SerializedName("requestId") private String requestId; + @SerializedName("context") + private Map context; + @SerializedName("action") private String action; @SerializedName("resource") private Map resource; + + /** + * Copy constructor. + * + * @param request Incoming DecisionRequest + */ + public DecisionRequest(DecisionRequest request) { + this.setOnapName(request.getOnapName()); + this.setOnapComponent(request.getOnapComponent()); + this.setOnapInstance(request.getOnapInstance()); + this.setRequestId(request.getRequestId()); + if (request.getContext() != null) { + this.setContext(new HashMap<>()); + this.getContext().putAll(request.getContext()); + } + this.setAction(request.getAction()); + if (request.getResource() != null) { + this.setResource(new HashMap<>()); + this.getResource().putAll(request.getResource()); + } + } } -- cgit 1.2.3-korg