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 {