Compare commits

...
3 Commits
Author SHA1 Message Date
deiflaender 206ad04322 test: old platform-commons 2022-05-11 10:40:32 +02:00
deiflaender fd2762e0f7 test Switched back to ObejctMapper 2022-05-11 10:21:20 +02:00
deiflaender cc2d02162d DSL-Json test 2022-05-11 09:42:57 +02:00
2 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -37,7 +37,7 @@
<dependency>
<groupId>com.iqser.red</groupId>
<artifactId>platform-commons-dependency</artifactId>
<version>1.13.0</version>
<version>1.11.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
@@ -2,6 +2,7 @@ package com.iqser.red.service.redaction.v1.server.storage;
import com.dslplatform.json.DslJson;
import com.dslplatform.json.runtime.Settings;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.file.FileType;
import com.iqser.red.service.redaction.v1.model.ImportedRedactions;
import com.iqser.red.service.redaction.v1.model.RedactionLog;
@@ -29,7 +30,7 @@ public class RedactionStorageService {
private final StorageService storageService;
private final DslJson<Object> dslJson = new DslJson<>(Settings.basicSetup());
private final ObjectMapper objectMapper;
@SneakyThrows
@@ -41,9 +42,8 @@ public class RedactionStorageService {
@SneakyThrows
public void storeObject(String dossierId, String fileId, FileType fileType, Object any) {
var baos = new ByteArrayOutputStream();
dslJson.serialize(any, baos);
storageService.storeObject(StorageIdUtils.getStorageId(dossierId, fileId, fileType), baos.toByteArray());
var bytes = objectMapper.writeValueAsBytes(any);
storageService.storeObject(StorageIdUtils.getStorageId(dossierId, fileId, fileType), bytes);
}
@SneakyThrows
@@ -64,7 +64,7 @@ public class RedactionStorageService {
}
try {
return dslJson.deserialize(ImportedRedactions.class, inputStreamResource.getInputStream());
return objectMapper.readValue(inputStreamResource.getInputStream(), ImportedRedactions.class);
} catch (IOException e) {
throw new RuntimeException("Could not imported redactions", e);
}
@@ -82,7 +82,7 @@ public class RedactionStorageService {
}
try {
return dslJson.deserialize(RedactionLog.class, inputStreamResource.getInputStream());
return objectMapper.readValue(inputStreamResource.getInputStream(), RedactionLog.class);
} catch (IOException e) {
throw new RuntimeException("Could not convert RedactionLog", e);
}
@@ -100,7 +100,7 @@ public class RedactionStorageService {
}
try {
return dslJson.deserialize(Text.class, inputStreamResource.getInputStream());
return objectMapper.readValue(inputStreamResource.getInputStream(), Text.class);
} catch (IOException e) {
throw new RuntimeException("Could not convert Text", e);
}
@@ -117,7 +117,7 @@ public class RedactionStorageService {
}
try {
return dslJson.deserialize(NerEntities.class, inputStreamResource.getInputStream());
return objectMapper.readValue(inputStreamResource.getInputStream(), NerEntities.class);
} catch (IOException e) {
throw new RuntimeException("Could not convert NER Entities", e);
}
@@ -128,7 +128,7 @@ public class RedactionStorageService {
try {
var sectionGrid = storageService.getObject(StorageIdUtils.getStorageId(dossierId, fileId, FileType.SECTION_GRID));
return dslJson.deserialize(SectionGrid.class, sectionGrid.getInputStream());
return objectMapper.readValue(sectionGrid.getInputStream(), SectionGrid.class);
} catch (StorageObjectDoesNotExist e) {
throw new NotFoundException("Section Grid is not available.");
} catch (IOException e) {