summaryrefslogtreecommitdiff
path: root/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java
diff options
context:
space:
mode:
authorThomas <>2022-01-19 14:00:06 +0100
committerThomas <>2022-01-19 14:00:06 +0100
commit122245400a8cbf72f65a206592eb15f70826ace9 (patch)
treedc2126cc95a3afb61771bc3c8b58337377d5652f /eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java
parent4932d6e3ef8b2347ecb0c66d5b8206fcfa54d77d (diff)
downloadEAAF-Components-122245400a8cbf72f65a206592eb15f70826ace9.tar.gz
EAAF-Components-122245400a8cbf72f65a206592eb15f70826ace9.tar.bz2
EAAF-Components-122245400a8cbf72f65a206592eb15f70826ace9.zip
refactor(core): change API parameters from 'Date' to 'Instant'
Diffstat (limited to 'eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java')
-rw-r--r--eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java31
1 files changed, 17 insertions, 14 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java
index 368652be..383b4535 100644
--- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java
+++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/data/AuthProcessDataWrapper.java
@@ -21,10 +21,12 @@ package at.gv.egiz.eaaf.core.impl.idp.auth.data;
import java.text.ParseException;
import java.text.SimpleDateFormat;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.TimeZone;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -54,8 +56,8 @@ public class AuthProcessDataWrapper
}
@Override
- public Date getIssueInstant() {
- return wrapStoredObject(VALUE_ISSUEINSTANT, null, Date.class);
+ public Instant getIssueInstant() {
+ return wrapStoredObject(VALUE_ISSUEINSTANT, null, Instant.class);
}
/*
@@ -67,7 +69,7 @@ public class AuthProcessDataWrapper
@Override
public String getIssueInstantString() {
return buildDateTimeUtcString(
- wrapStoredObject(VALUE_ISSUEINSTANT, null, Date.class));
+ wrapStoredObject(VALUE_ISSUEINSTANT, null, Instant.class));
}
/*
@@ -92,7 +94,7 @@ public class AuthProcessDataWrapper
* java.lang.String)
*/
@Override
- public void setIssueInstant(final Date issueInstant) {
+ public void setIssueInstant(final Instant issueInstant) {
authProcessData.put(VALUE_ISSUEINSTANT, issueInstant);
}
@@ -347,16 +349,17 @@ public class AuthProcessDataWrapper
* <code>yyyy-MM-dd'T'HH:mm:ss'Z'</code>, or <code>null</code> if {@link Date} was <code>null</code>
*/
@Nullable
- public static String buildDateTimeUtcString(@Nullable final Date date) {
+ public static String buildDateTimeUtcString(@Nullable final Instant date) {
if (date == null) {
return null;
}
-
- final SimpleDateFormat f = new SimpleDateFormat(PATTERN_ISSUE_INSTANT);
- f.setTimeZone(TimeZone.getTimeZone("UTC"));
- return f.format(date.getTime());
-
+
+ return DateTimeFormatter
+ .ofPattern(PATTERN_ISSUE_INSTANT)
+ .withZone(ZoneId.of("UTC"))
+ .format(date);
+
}
/**
@@ -368,11 +371,11 @@ public class AuthProcessDataWrapper
* if input parameter was <code>null</code> or invalid
*/
@Nullable
- public static Date buildDateTimeUtcDate(@Nullable final String date) {
+ public static Instant buildDateTimeUtcDate(@Nullable final String date) {
final SimpleDateFormat f = new SimpleDateFormat(PATTERN_ISSUE_INSTANT);
try {
- if (date != null) {
- return f.parse(date);
+ if (date != null) {
+ return f.parse(date).toInstant();
}