From 5045e171aa3734087fd455dc433f2cb71faed453 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Wed, 17 Feb 2021 15:43:43 -0600 Subject: Add time and date attributes to DecisionRequest These are optional for clients, but may be necessary in configurations where the application enforcing a guard is running in a different time zone. Allows some flexibility instead of always using the time zone that the xacml pdp is running in. Issue-ID: POLICY-2810 Change-Id: I4057e5956e59803cc9505fae0ee4e2f67eaf0358 Signed-off-by: Pamela Dragosh --- .../models/decisions/concepts/DecisionRequest.java | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'models-decisions') 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 ca1e9e207..163d2cf92 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP Policy Decision Models * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,10 @@ package org.onap.policy.models.decisions.concepts; import com.google.gson.annotations.SerializedName; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.OffsetTime; +import java.time.ZoneOffset; import java.util.HashMap; import java.util.Map; import lombok.Data; @@ -53,6 +57,18 @@ public class DecisionRequest { @SerializedName("action") private String action; + @SerializedName("currentDateTime") + private OffsetDateTime currentDateTime; + + @SerializedName("currentDate") + private LocalDate currentDate; + + @SerializedName("currentTime") + private OffsetTime currentTime; + + @SerializedName("timeZone") + private ZoneOffset timeZone; + @SerializedName("resource") private Map resource; @@ -71,6 +87,10 @@ public class DecisionRequest { this.getContext().putAll(request.getContext()); } this.setAction(request.getAction()); + this.setCurrentDate(request.getCurrentDate()); + this.setCurrentDateTime(request.getCurrentDateTime()); + this.setCurrentTime(request.getCurrentTime()); + this.setTimeZone(request.getTimeZone()); if (request.getResource() != null) { this.setResource(new HashMap<>()); this.getResource().putAll(request.getResource()); -- cgit 1.2.3-korg