h2020_dataset.docx & WordBuilder.java & DataManagementPlanManager.java & DatasetManager.java: Updated footer of Dataset template to set title of DMP and Dataset.

This commit is contained in:
Konstantina Galouni 2022-07-28 17:30:44 +03:00
parent fa723c07ae
commit 49e42e9cba
4 changed files with 7 additions and 3 deletions
dmp-backend/web/src/main
java/eu/eudat/logic
resources/documents

View File

@ -1368,7 +1368,7 @@ public class DataManagementPlanManager {
document.removeBodyElement(powered_pos + 1);
}
wordBuilder.fillFooter(dmpEntity, document, false);
wordBuilder.fillFooter(dmpEntity, null, document, false);
String fileName = "DMP_" + dmpEntity.getGrant().getLabel();
if (versioned) {

View File

@ -407,7 +407,7 @@ public class DatasetManager {
throw new UnauthorisedException();
wordBuilder.fillFirstPage(dmpEntity, datasetEntity, document);
wordBuilder.fillFooter(dmpEntity, document, true);
wordBuilder.fillFooter(dmpEntity, datasetEntity, document, true);
int powered_pos = wordBuilder.findPosOfPoweredBy(document);
XWPFParagraph powered_par = null;

View File

@ -770,7 +770,7 @@ public class WordBuilder {
}
}
public void fillFooter(DMP dmpEntity, XWPFDocument document, boolean isDataset) {
public void fillFooter(DMP dmpEntity, Dataset datasetEntity, XWPFDocument document, boolean isDataset) {
document.getFooterList().forEach(xwpfFooter -> {
List<XWPFRun> runs = xwpfFooter.getParagraphs().get(0).getRuns();
if(runs != null){
@ -781,6 +781,10 @@ public class WordBuilder {
text = text.replace("{ARGOS.DMP.TITLE}", dmpEntity.getLabel());
r.setText(text, 0);
}
if(text.contains("{ARGOS.DATASET.TITLE}") && datasetEntity != null){
text = text.replace("{ARGOS.DATASET.TITLE}", datasetEntity.getLabel());
r.setText(text, 0);
}
if(text.contains("{ARGOS.DMP.LICENSE}")){
try{
Map<String, String> license = ((Map<String, String>) mapper.readValue(dmpEntity.getExtraProperties(), Map.class).get("license"));