diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2021-02-17 15:43:43 -0600 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2021-02-17 15:44:04 -0600 |
commit | 5045e171aa3734087fd455dc433f2cb71faed453 (patch) | |
tree | 12ca6786c50d19a18d0f9fbf3c93c6ad1ef4e7f2 /models-decisions/src/main | |
parent | 9fb6de04f2402c29a4a792cc118f5bbb53906f81 (diff) |
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 <pdragosh@research.att.com>
Diffstat (limited to 'models-decisions/src/main')
-rw-r--r-- | models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionRequest.java | 22 |
1 files changed, 21 insertions, 1 deletions
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<String, Object> 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()); |