dmp file name as dmp model label

This commit is contained in:
amentis 2024-05-28 09:44:10 +03:00
parent af0927d3e8
commit eabfe8a668
1 changed files with 9 additions and 6 deletions

View File

@ -418,17 +418,20 @@ public class WordFileTransformerService implements FileTransformerClient {
if (dmpModel == null) throw new MyApplicationException("DmpEntity required"); if (dmpModel == null) throw new MyApplicationException("DmpEntity required");
List<ReferenceModel> grants = this.getReferenceModelOfTypeCode(dmpModel, this.wordFileTransformerServiceProperties.getGrantReferenceCode(), null); List<ReferenceModel> 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) { if (!grants.isEmpty() && grants.getFirst().getLabel() != null) {
fileName = "DMP_" + grants.getFirst().getLabel(); fileName = "DMP_" + grants.getFirst().getLabel();
}
else {
fileName = "DMP_" + dmpModel.getLabel();
}
fileName += "_" + dmpModel.getVersion(); fileName += "_" + dmpModel.getVersion();
return fileName + extension; return fileName + extension;
} }
return fileName;
}
private byte[] buildDescriptionWordDocument(DescriptionModel descriptionModel) throws IOException { private byte[] buildDescriptionWordDocument(DescriptionModel descriptionModel) throws IOException {
if (descriptionModel == null) throw new MyApplicationException("DmpEntity required"); if (descriptionModel == null) throw new MyApplicationException("DmpEntity required");
DmpModel dmpEntity = descriptionModel.getDmp(); DmpModel dmpEntity = descriptionModel.getDmp();