update file transformer base

This commit is contained in:
amentis 2024-06-18 14:47:17 +03:00
parent 8fc3fcd561
commit defc613070
4 changed files with 50 additions and 13 deletions

View File

@ -10,6 +10,8 @@ public class AuditableAction {
public static final EventId FileTransformer_ImportFileToDmp = new EventId(1002, "FileTransformer_ImportFileToDmp"); public static final EventId FileTransformer_ImportFileToDmp = new EventId(1002, "FileTransformer_ImportFileToDmp");
public static final EventId FileTransformer_ImportFileToDescription = new EventId(1003, "FileTransformer_ImportFileToDescription"); public static final EventId FileTransformer_ImportFileToDescription = new EventId(1003, "FileTransformer_ImportFileToDescription");
public static final EventId FileTransformer_GetSupportedFormats = new EventId(1004, "FileTransformer_GetSupportedFormats"); public static final EventId FileTransformer_GetSupportedFormats = new EventId(1004, "FileTransformer_GetSupportedFormats");
public static final EventId FileTransformer_PreprocessingDmp = new EventId(1005, "FileTransformer_PreprocessingDmp");
public static final EventId FileTransformer_PreprocessingDescription = new EventId(1006, "FileTransformer_PreprocessingDescription");
} }

View File

@ -18,7 +18,7 @@ import org.opencdmp.filetransformerbase.enums.FileTransformerEntityType;
import org.opencdmp.filetransformerbase.interfaces.FileTransformerClient; import org.opencdmp.filetransformerbase.interfaces.FileTransformerClient;
import org.opencdmp.filetransformerbase.interfaces.FileTransformerConfiguration; import org.opencdmp.filetransformerbase.interfaces.FileTransformerConfiguration;
import org.opencdmp.filetransformer.docx.model.enums.FileFormats; import org.opencdmp.filetransformer.docx.model.enums.FileFormats;
import org.opencdmp.filetransformerbase.models.misc.FileFormat; import org.opencdmp.filetransformerbase.models.misc.*;
import org.opencdmp.filetransformer.docx.service.pdf.PdfService; import org.opencdmp.filetransformer.docx.service.pdf.PdfService;
import org.opencdmp.filetransformer.docx.model.enums.ParagraphStyle; import org.opencdmp.filetransformer.docx.model.enums.ParagraphStyle;
import org.opencdmp.filetransformer.docx.service.storage.FileStorageService; import org.opencdmp.filetransformer.docx.service.storage.FileStorageService;
@ -124,12 +124,12 @@ public class WordFileTransformerService implements FileTransformerClient {
@Override @Override
public DmpModel importDmp(FileEnvelopeModel envelope) { public DmpModel importDmp(DmpImportModel dmpImportModel) {
throw new MyApplicationException("import not supported"); throw new MyApplicationException("import not supported");
} }
@Override @Override
public DescriptionModel importDescription(FileEnvelopeModel envelope) { public DescriptionModel importDescription(DescriptionImportModel descriptionImportModel) {
throw new MyApplicationException("import not supported"); throw new MyApplicationException("import not supported");
} }
@ -144,6 +144,16 @@ public class WordFileTransformerService implements FileTransformerClient {
return configuration; return configuration;
} }
@Override
public PreprocessingDmpModel preprocessingDmp(FileEnvelopeModel fileEnvelopeModel) {
throw new MyApplicationException("preprocessing not supported");
}
@Override
public PreprocessingDescriptionModel preprocessingDescription(FileEnvelopeModel fileEnvelopeModel) {
throw new MyApplicationException("preprocessing not supported");
}
private List<ReferenceModel> getReferenceModelOfTypeCode(DmpModel dmp, String code, UUID blueprintId){ private List<ReferenceModel> getReferenceModelOfTypeCode(DmpModel dmp, String code, UUID blueprintId){
List<ReferenceModel> response = new ArrayList<>(); List<ReferenceModel> response = new ArrayList<>();
if (dmp.getReferences() == null) return response; if (dmp.getReferences() == null) return response;

View File

@ -27,7 +27,7 @@
<dependency> <dependency>
<groupId>org.opencdmp</groupId> <groupId>org.opencdmp</groupId>
<artifactId>file-transformer-base</artifactId> <artifactId>file-transformer-base</artifactId>
<version>0.0.22</version> <version>0.0.23</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.yaml</groupId> <groupId>org.yaml</groupId>

View File

@ -10,6 +10,10 @@ import org.opencdmp.filetransformer.docx.audit.AuditableAction;
import org.opencdmp.filetransformerbase.interfaces.FileTransformerClient; import org.opencdmp.filetransformerbase.interfaces.FileTransformerClient;
import org.opencdmp.filetransformerbase.interfaces.FileTransformerConfiguration; import org.opencdmp.filetransformerbase.interfaces.FileTransformerConfiguration;
import org.opencdmp.filetransformer.docx.service.wordfiletransformer.WordFileTransformerService; import org.opencdmp.filetransformer.docx.service.wordfiletransformer.WordFileTransformerService;
import org.opencdmp.filetransformerbase.models.misc.DescriptionImportModel;
import org.opencdmp.filetransformerbase.models.misc.DmpImportModel;
import org.opencdmp.filetransformerbase.models.misc.PreprocessingDescriptionModel;
import org.opencdmp.filetransformerbase.models.misc.PreprocessingDmpModel;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -56,29 +60,50 @@ public class FileTransformerController implements org.opencdmp.filetransformerba
return model; return model;
} }
public DmpModel importFileToDmp(@RequestBody FileEnvelopeModel fileEnvelope) { public DmpModel importFileToDmp(@RequestBody DmpImportModel dmpImportModel) {
logger.debug(new MapLogEntry("importFileToDmp " + FileEnvelopeModel.class.getSimpleName()).And("fileEnvelope", fileEnvelope)); logger.debug(new MapLogEntry("importFileToDmp " + FileEnvelopeModel.class.getSimpleName()).And("fileEnvelope", dmpImportModel.getFile()));
DmpModel model = fileTransformerExecutor.importDmp(fileEnvelope); DmpModel model = fileTransformerExecutor.importDmp(dmpImportModel);
this.auditService.track(AuditableAction.FileTransformer_ImportFileToDmp, Map.ofEntries( this.auditService.track(AuditableAction.FileTransformer_ImportFileToDmp, Map.ofEntries(
new AbstractMap.SimpleEntry<String, Object>("fileEnvelope", fileEnvelope) new AbstractMap.SimpleEntry<String, Object>("fileEnvelope", dmpImportModel.getFile())
)); ));
return model; return model;
} }
public DescriptionModel importFileToDescription(@RequestBody FileEnvelopeModel fileEnvelope) { public DescriptionModel importFileToDescription(@RequestBody DescriptionImportModel descriptionImportModel) {
logger.debug(new MapLogEntry("importFileToDescription " + FileEnvelopeModel.class.getSimpleName()).And("fileEnvelope", fileEnvelope)); logger.debug(new MapLogEntry("importFileToDescription " + FileEnvelopeModel.class.getSimpleName()).And("fileEnvelope", descriptionImportModel.getFile()));
DescriptionModel model = fileTransformerExecutor.importDescription(fileEnvelope); DescriptionModel model = fileTransformerExecutor.importDescription(descriptionImportModel);
this.auditService.track(AuditableAction.FileTransformer_ImportFileToDescription, Map.ofEntries( this.auditService.track(AuditableAction.FileTransformer_ImportFileToDescription, Map.ofEntries(
new AbstractMap.SimpleEntry<String, Object>("importFileToDescription ", fileEnvelope) new AbstractMap.SimpleEntry<String, Object>("importFileToDescription ", descriptionImportModel.getFile())
)); ));
return model; return model;
} }
public PreprocessingDmpModel preprocessingDmp(FileEnvelopeModel fileEnvelopeModel) {
logger.debug(new MapLogEntry("PreprocessingDmpModel " + FileEnvelopeModel.class.getSimpleName()).And("fileEnvelope", fileEnvelopeModel));
PreprocessingDmpModel model = fileTransformerExecutor.preprocessingDmp(fileEnvelopeModel);
this.auditService.track(AuditableAction.FileTransformer_PreprocessingDmp, Map.ofEntries(
new AbstractMap.SimpleEntry<String, Object>("importFileToDescription ", fileEnvelopeModel)
));
return model;
}
public PreprocessingDescriptionModel preprocessingDescription(FileEnvelopeModel fileEnvelopeModel) {
logger.debug(new MapLogEntry("PreprocessingDescriptionModel " + FileEnvelopeModel.class.getSimpleName()).And("fileEnvelope", fileEnvelopeModel));
PreprocessingDescriptionModel model = fileTransformerExecutor.preprocessingDescription(fileEnvelopeModel);
this.auditService.track(AuditableAction.FileTransformer_PreprocessingDescription, Map.ofEntries(
new AbstractMap.SimpleEntry<String, Object>("importFileToDescription ", fileEnvelopeModel)
));
return model; }
public FileTransformerConfiguration getSupportedFormats() { public FileTransformerConfiguration getSupportedFormats() {
logger.debug(new MapLogEntry("getSupportedFormats")); logger.debug(new MapLogEntry("getSupportedFormats"));