Adds missing properties "Funder" and "Project" from DMP xml export.

This commit is contained in:
gkolokythas 2019-12-18 10:55:08 +02:00
parent 4e3a3b573a
commit e50bef555f
1 changed files with 25 additions and 5 deletions

View File

@ -567,7 +567,7 @@ public class DataManagementPlanManager {
}
public void assignUser(DMP dmp, UserInfo userInfo) {
private void assignUser(DMP dmp, UserInfo userInfo) {
UserDMP userDMP = new UserDMP();
userDMP.setDmp(dmp);
userDMP.setUser(userInfo);
@ -835,7 +835,7 @@ public class DataManagementPlanManager {
}
}
public FileEnvelope getXmlDocument(String id, Principal principal) throws InstantiationException, IllegalAccessException, IOException {
private FileEnvelope getXmlDocument(String id, Principal principal) throws InstantiationException, IllegalAccessException, IOException {
ExportXmlBuilder xmlBuilder = new ExportXmlBuilder();
VisibilityRuleService visibilityRuleService = utilitiesService.getVisibilityRuleService();
eu.eudat.data.entities.DMP dmp = databaseRepository.getDmpDao().find(UUID.fromString(id));
@ -870,14 +870,34 @@ public class DataManagementPlanManager {
}
dmpElement.appendChild(dmpProfileElement);
// Funder.
Element funder = xmlDoc.createElement("funder");
Element funderLabel = xmlDoc.createElement("label");
Element funderId = xmlDoc.createElement("id");
funderLabel.setTextContent(dmp.getGrant().getFunder().getLabel());
funderId.setTextContent(dmp.getGrant().getFunder().getId().toString());
funder.appendChild(funderLabel);
funder.appendChild(funderId);
dmpElement.appendChild(funder);
// Grant.
Element grant = xmlDoc.createElement("grant");
Element label = xmlDoc.createElement("label");
label.setTextContent(dmp.getGrant().getLabel());
grant.appendChild(label);
Element grantLabel = xmlDoc.createElement("label");
Element grantId = xmlDoc.createElement("id");
grantLabel.setTextContent(dmp.getGrant().getLabel());
grantId.setTextContent(dmp.getGrant().getId().toString());
grant.appendChild(grantLabel);
grant.appendChild(grantId);
dmpElement.appendChild(grant);
// Project.
Element project = xmlDoc.createElement("project");
Element projectLabel = xmlDoc.createElement("label");
Element projectId = xmlDoc.createElement("id");
projectLabel.setTextContent(dmp.getProject().getLabel());
projectId.setTextContent(dmp.getProject().getId().toString());
project.appendChild(projectLabel);
project.appendChild(projectId);
dmpElement.appendChild(project);
Element organisationsElement = xmlDoc.createElement("organisations");
for (Organisation organisation : dmp.getOrganisations()) {
Element organisationElement = xmlDoc.createElement("organisation");