From f76f11bc9742b4ad7a3bd9abd1ba97486eae183b Mon Sep 17 00:00:00 2001 From: Nicholas Jaunsen <3789764+skykanin@users.noreply.github.com> Date: Thu, 29 Feb 2024 14:15:22 +0100 Subject: [PATCH] more serialization changes.. hopefully final --- .../dlp/pseudo/service/sid/MultiSidLookupResponse.java | 2 ++ .../no/ssb/dlp/pseudo/service/sid/MultiSidResponse.java | 1 + src/main/java/no/ssb/dlp/pseudo/service/sid/SidInfo.java | 2 ++ .../java/no/ssb/dlp/pseudo/service/sid/SidMapper.java | 6 +++--- .../java/no/ssb/dlp/pseudo/service/sid/SnapshotInfo.java | 9 +++++---- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/no/ssb/dlp/pseudo/service/sid/MultiSidLookupResponse.java b/src/main/java/no/ssb/dlp/pseudo/service/sid/MultiSidLookupResponse.java index 27c9e73..bb26a3f 100644 --- a/src/main/java/no/ssb/dlp/pseudo/service/sid/MultiSidLookupResponse.java +++ b/src/main/java/no/ssb/dlp/pseudo/service/sid/MultiSidLookupResponse.java @@ -1,5 +1,6 @@ package no.ssb.dlp.pseudo.service.sid; +import io.micronaut.core.annotation.Introspected; import io.micronaut.serde.annotation.Serdeable; import lombok.Builder; import lombok.extern.jackson.Jacksonized; @@ -8,5 +9,6 @@ @Builder @Jacksonized +@Introspected @Serdeable public record MultiSidLookupResponse (List missing, String datasetExtractionSnapshotTime) {} \ No newline at end of file diff --git a/src/main/java/no/ssb/dlp/pseudo/service/sid/MultiSidResponse.java b/src/main/java/no/ssb/dlp/pseudo/service/sid/MultiSidResponse.java index c92f7ad..0a1f1ce 100644 --- a/src/main/java/no/ssb/dlp/pseudo/service/sid/MultiSidResponse.java +++ b/src/main/java/no/ssb/dlp/pseudo/service/sid/MultiSidResponse.java @@ -25,6 +25,7 @@ public class MultiSidResponse { @Builder @Jacksonized @Introspected + @Serdeable public record Mapping (List fnrList, List snr, List fnr) { } public Map toMap() { diff --git a/src/main/java/no/ssb/dlp/pseudo/service/sid/SidInfo.java b/src/main/java/no/ssb/dlp/pseudo/service/sid/SidInfo.java index 3d6d4c4..e522db4 100644 --- a/src/main/java/no/ssb/dlp/pseudo/service/sid/SidInfo.java +++ b/src/main/java/no/ssb/dlp/pseudo/service/sid/SidInfo.java @@ -1,10 +1,12 @@ package no.ssb.dlp.pseudo.service.sid; +import io.micronaut.core.annotation.Introspected; import io.micronaut.serde.annotation.Serdeable; import lombok.Builder; import lombok.extern.jackson.Jacksonized; @Builder @Jacksonized +@Introspected @Serdeable public record SidInfo (String fnr, String snr, String datasetExtractionSnapshotTime) {} \ No newline at end of file diff --git a/src/main/java/no/ssb/dlp/pseudo/service/sid/SidMapper.java b/src/main/java/no/ssb/dlp/pseudo/service/sid/SidMapper.java index d57216c..bcf699d 100644 --- a/src/main/java/no/ssb/dlp/pseudo/service/sid/SidMapper.java +++ b/src/main/java/no/ssb/dlp/pseudo/service/sid/SidMapper.java @@ -132,9 +132,9 @@ public void setConfig(Map config) { parse(config.get(MapFuncConfig.Param.SNAPSHOT_DATE).toString())); } catch (DateTimeParseException e) { throw new InvalidSidSnapshotDateException(String.format("Invalid snapshot date format. Valid dates are: %s", - String.join(", ", availableSnapshots.getItems()))); + String.join(", ", availableSnapshots.items()))); } - List availableSnapshotDates = availableSnapshots.getItems().stream() + List availableSnapshotDates = availableSnapshots.items().stream() .map(snapshot -> { try { return LocalDate.from(formatter.parse(snapshot)); @@ -144,7 +144,7 @@ public void setConfig(Map config) { }).toList(); if(availableSnapshotDates.stream().allMatch(requestedSnapshotDate::isBefore)){ throw new InvalidSidSnapshotDateException(String.format("Requested date is of an earlier date than all available SID dates. Valid dates are: %s", - String.join(", ", availableSnapshots.getItems()))); + String.join(", ", availableSnapshots.items()))); } } this.config = config; diff --git a/src/main/java/no/ssb/dlp/pseudo/service/sid/SnapshotInfo.java b/src/main/java/no/ssb/dlp/pseudo/service/sid/SnapshotInfo.java index 56a2689..cda5838 100644 --- a/src/main/java/no/ssb/dlp/pseudo/service/sid/SnapshotInfo.java +++ b/src/main/java/no/ssb/dlp/pseudo/service/sid/SnapshotInfo.java @@ -1,14 +1,15 @@ package no.ssb.dlp.pseudo.service.sid; +import io.micronaut.core.annotation.Introspected; +import io.micronaut.serde.annotation.Serdeable; import lombok.Builder; import lombok.Data; import lombok.extern.jackson.Jacksonized; import java.util.List; -@Data @Builder @Jacksonized -public class SnapshotInfo { - private final List items; -} +@Introspected +@Serdeable +public record SnapshotInfo(List items) {}