Replace the openDMP Affiliation on Zenodo with either a configurable

affiliation or the related organizations of the DMP
This commit is contained in:
George Kalampokis 2020-11-19 18:39:25 +02:00
parent 52317c10f9
commit 66358acfcf
2 changed files with 32 additions and 3 deletions

View File

@ -1823,7 +1823,20 @@ public class DataManagementPlanManager {
dataBuilder.append("{\n");
dataBuilder.append(" \t\t\"name\": \"").append(userDMP.getUser().getName()).append("\",\n");
dataBuilder.append(" \t\t\"type\": \"").append("ProjectMember").append("\",\n");
dataBuilder.append(" \t\t\"affiliation\": \"OpenDMP\"\n}");
if (dmp.getOrganisations() != null && !dmp.getOrganisations().isEmpty()) {
dataBuilder.append(" \t\t\"affiliation\": \"");
int j = 0;
for (Organisation organization: dmp.getOrganisations()) {
if (j > 0) {
dataBuilder.append(", ");
}
dataBuilder.append(organization.getLabel());
j++;
}
dataBuilder.append("\"\n}");
} else {
dataBuilder.append(" \t\t\"affiliation\": \"" + this.environment.getProperty("zenodo.affiliation") +"\"\n}");
}
i++;
}
for(Researcher researcher: dmp.getResearchers()) {
@ -1853,7 +1866,20 @@ public class DataManagementPlanManager {
}
dataBuilder.append(" \"creators\": [{\n");
dataBuilder.append(" \t\t\"name\": \"").append(dmp.getUsers().stream().filter(userDMP -> userDMP.getRole().equals(UserDMP.UserDMPRoles.OWNER.getValue())).findFirst().get().getUser().getName()).append("\",\n");
dataBuilder.append(" \t\t\"affiliation\": \"OpenDMP\"}]\n");
if (dmp.getOrganisations() != null && !dmp.getOrganisations().isEmpty()) {
dataBuilder.append(" \t\t\"affiliation\": \"");
int j = 0;
for (Organisation organization: dmp.getOrganisations()) {
if (j > 0) {
dataBuilder.append(", ");
}
dataBuilder.append(organization.getLabel());
j++;
}
dataBuilder.append("\"}]\n");
} else {
dataBuilder.append(" \t\t\"affiliation\": \"" + this.environment.getProperty("zenodo.affiliation") +"\"}]\n");
}
dataBuilder.append(" }\n").append("}");
createData = dataBuilder.toString();
JsonNode createDataJSON = new ObjectMapper().readTree(createData);

View File

@ -89,4 +89,7 @@ notification.modifiedFinalised.subject=[OpenDMP] The {name} has been modified an
logging.config=classpath:logging/logback-${spring.profiles.active}.xml
#############TEMP#########
temp.temp=tmp/
temp.temp=tmp/
#############ZENODO#########
zenodo.affiliation=ARGOS