Add time and date attributes to DecisionRequest 01/118001/1
authorPamela Dragosh <pdragosh@research.att.com>
Wed, 17 Feb 2021 21:43:43 +0000 (15:43 -0600)
committerPamela Dragosh <pdragosh@research.att.com>
Wed, 17 Feb 2021 21:44:04 +0000 (15:44 -0600)
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>
models-decisions/src/main/java/org/onap/policy/models/decisions/concepts/DecisionRequest.java

index ca1e9e2..163d2cf 100644 (file)
@@ -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.
 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());