From cc2d02162d4d9b7d1b94cb026f49a10608b91c2e Mon Sep 17 00:00:00 2001 From: deiflaender Date: Wed, 11 May 2022 09:42:57 +0200 Subject: [PATCH] DSL-Json test --- .../v1/server/storage/RedactionStorageService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/storage/RedactionStorageService.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/storage/RedactionStorageService.java index 62bf9b1e..0186b4d3 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/storage/RedactionStorageService.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/storage/RedactionStorageService.java @@ -42,6 +42,7 @@ public class RedactionStorageService { @SneakyThrows public void storeObject(String dossierId, String fileId, FileType fileType, Object any) { var baos = new ByteArrayOutputStream(); + dslJson.newWriter(); dslJson.serialize(any, baos); storageService.storeObject(StorageIdUtils.getStorageId(dossierId, fileId, fileType), baos.toByteArray()); } @@ -64,6 +65,7 @@ public class RedactionStorageService { } try { + dslJson.newReader(); return dslJson.deserialize(ImportedRedactions.class, inputStreamResource.getInputStream()); } catch (IOException e) { throw new RuntimeException("Could not imported redactions", e); @@ -82,6 +84,7 @@ public class RedactionStorageService { } try { + dslJson.newReader(); return dslJson.deserialize(RedactionLog.class, inputStreamResource.getInputStream()); } catch (IOException e) { throw new RuntimeException("Could not convert RedactionLog", e); @@ -100,6 +103,7 @@ public class RedactionStorageService { } try { + dslJson.newReader(); return dslJson.deserialize(Text.class, inputStreamResource.getInputStream()); } catch (IOException e) { throw new RuntimeException("Could not convert Text", e); @@ -117,6 +121,7 @@ public class RedactionStorageService { } try { + dslJson.newReader(); return dslJson.deserialize(NerEntities.class, inputStreamResource.getInputStream()); } catch (IOException e) { throw new RuntimeException("Could not convert NER Entities", e); @@ -128,6 +133,7 @@ public class RedactionStorageService { try { var sectionGrid = storageService.getObject(StorageIdUtils.getStorageId(dossierId, fileId, FileType.SECTION_GRID)); + dslJson.newReader(); return dslJson.deserialize(SectionGrid.class, sectionGrid.getInputStream()); } catch (StorageObjectDoesNotExist e) { throw new NotFoundException("Section Grid is not available.");