From eabfe8a66803fab41a71691cad93219ec40612e6 Mon Sep 17 00:00:00 2001 From: amentis Date: Tue, 28 May 2024 09:44:10 +0300 Subject: [PATCH] dmp file name as dmp model label --- .../WordFileTransformerService.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/org/opencdmp/filetransformer/docx/service/wordfiletransformer/WordFileTransformerService.java b/core/src/main/java/org/opencdmp/filetransformer/docx/service/wordfiletransformer/WordFileTransformerService.java index c75c26e..84f1159 100644 --- a/core/src/main/java/org/opencdmp/filetransformer/docx/service/wordfiletransformer/WordFileTransformerService.java +++ b/core/src/main/java/org/opencdmp/filetransformer/docx/service/wordfiletransformer/WordFileTransformerService.java @@ -418,15 +418,18 @@ public class WordFileTransformerService implements FileTransformerClient { if (dmpModel == null) throw new MyApplicationException("DmpEntity required"); List grants = this.getReferenceModelOfTypeCode(dmpModel, this.wordFileTransformerServiceProperties.getGrantReferenceCode(), null); - String fileName; + String fileName = null; + if (dmpModel.getLabel() != null){ + return dmpModel.getLabel(); + } if (!grants.isEmpty() && grants.getFirst().getLabel() != null) { fileName = "DMP_" + grants.getFirst().getLabel(); + fileName += "_" + dmpModel.getVersion(); + + return fileName + extension; } - else { - fileName = "DMP_" + dmpModel.getLabel(); - } - fileName += "_" + dmpModel.getVersion(); - return fileName + extension; + + return fileName; } private byte[] buildDescriptionWordDocument(DescriptionModel descriptionModel) throws IOException {