Merge branch 'RED-9255' into 'master'
Some NPE fixes Closes RED-9255 See merge request redactmanager/persistence-service!574
This commit is contained in:
commit
4a56bbc07f
@ -20,6 +20,7 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.FileStatusF
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.FileExchangeExportRequest;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
|
||||
@ -144,6 +145,6 @@ public interface SupportResource {
|
||||
@PostMapping(value = FILE_EXCHANGE_REST_PATH + IMPORT, consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Imports a file exchange export zip.", description = "Use this endpoint to import a full export of a given Dossier Template including all its configurations, dossiers, and files.")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
||||
void importFiles(@RequestPart(name = "file") MultipartFile file);
|
||||
void importFiles(@Schema(type = "string", format = "binary", name = "file") @RequestPart(name = "file") MultipartFile file);
|
||||
|
||||
}
|
||||
|
||||
@ -96,6 +96,9 @@ public class EntityTypeImportService {
|
||||
@Observed(name = "EntityTypeImportService", contextualName = "import-entity-type")
|
||||
public void importEntityTypes(String dossierTemplateId, String dossierId, EntityTypeImportModel importModel) {
|
||||
|
||||
if (importModel == null) {
|
||||
return;
|
||||
}
|
||||
enrichObservation(importModel);
|
||||
|
||||
for (Type type : importModel.getTypes()) {
|
||||
|
||||
@ -50,7 +50,8 @@ public class FileImportService {
|
||||
}
|
||||
|
||||
|
||||
private void importFile(String userId, TemplateImportInfo templateImportInfo, FileExchangeImportModel.FileImport file, String dossierId) {
|
||||
@Observed(name = "FileImportService", contextualName = "import-file")
|
||||
public void importFile(String userId, TemplateImportInfo templateImportInfo, FileExchangeImportModel.FileImport file, String dossierId) {
|
||||
|
||||
// separate service for transactions
|
||||
String fileId = fileImportPersistenceService.saveFileToDb(userId, file, dossierId, templateImportInfo);
|
||||
@ -64,8 +65,9 @@ public class FileImportService {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
|
||||
storageService.saveEntityLog(dossierId, fileId, file.getEntityLog());
|
||||
if (file.getEntityLog() != null) {
|
||||
storageService.saveEntityLog(dossierId, fileId, file.getEntityLog());
|
||||
}
|
||||
if (file.getComponentLog() != null) {
|
||||
storageService.saveComponentLog(dossierId, fileId, file.getComponentLog());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user