DSL-Json test
This commit is contained in:
parent
d2807e0ff1
commit
cc2d02162d
@ -42,6 +42,7 @@ public class RedactionStorageService {
|
|||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public void storeObject(String dossierId, String fileId, FileType fileType, Object any) {
|
public void storeObject(String dossierId, String fileId, FileType fileType, Object any) {
|
||||||
var baos = new ByteArrayOutputStream();
|
var baos = new ByteArrayOutputStream();
|
||||||
|
dslJson.newWriter();
|
||||||
dslJson.serialize(any, baos);
|
dslJson.serialize(any, baos);
|
||||||
storageService.storeObject(StorageIdUtils.getStorageId(dossierId, fileId, fileType), baos.toByteArray());
|
storageService.storeObject(StorageIdUtils.getStorageId(dossierId, fileId, fileType), baos.toByteArray());
|
||||||
}
|
}
|
||||||
@ -64,6 +65,7 @@ public class RedactionStorageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
dslJson.newReader();
|
||||||
return dslJson.deserialize(ImportedRedactions.class, inputStreamResource.getInputStream());
|
return dslJson.deserialize(ImportedRedactions.class, inputStreamResource.getInputStream());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException("Could not imported redactions", e);
|
throw new RuntimeException("Could not imported redactions", e);
|
||||||
@ -82,6 +84,7 @@ public class RedactionStorageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
dslJson.newReader();
|
||||||
return dslJson.deserialize(RedactionLog.class, inputStreamResource.getInputStream());
|
return dslJson.deserialize(RedactionLog.class, inputStreamResource.getInputStream());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException("Could not convert RedactionLog", e);
|
throw new RuntimeException("Could not convert RedactionLog", e);
|
||||||
@ -100,6 +103,7 @@ public class RedactionStorageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
dslJson.newReader();
|
||||||
return dslJson.deserialize(Text.class, inputStreamResource.getInputStream());
|
return dslJson.deserialize(Text.class, inputStreamResource.getInputStream());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException("Could not convert Text", e);
|
throw new RuntimeException("Could not convert Text", e);
|
||||||
@ -117,6 +121,7 @@ public class RedactionStorageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
dslJson.newReader();
|
||||||
return dslJson.deserialize(NerEntities.class, inputStreamResource.getInputStream());
|
return dslJson.deserialize(NerEntities.class, inputStreamResource.getInputStream());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException("Could not convert NER Entities", e);
|
throw new RuntimeException("Could not convert NER Entities", e);
|
||||||
@ -128,6 +133,7 @@ public class RedactionStorageService {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
var sectionGrid = storageService.getObject(StorageIdUtils.getStorageId(dossierId, fileId, FileType.SECTION_GRID));
|
var sectionGrid = storageService.getObject(StorageIdUtils.getStorageId(dossierId, fileId, FileType.SECTION_GRID));
|
||||||
|
dslJson.newReader();
|
||||||
return dslJson.deserialize(SectionGrid.class, sectionGrid.getInputStream());
|
return dslJson.deserialize(SectionGrid.class, sectionGrid.getInputStream());
|
||||||
} catch (StorageObjectDoesNotExist e) {
|
} catch (StorageObjectDoesNotExist e) {
|
||||||
throw new NotFoundException("Section Grid is not available.");
|
throw new NotFoundException("Section Grid is not available.");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user