Don't include Funder if it's not in the Doi Funder Table

This commit is contained in:
George Kalampokis 2022-02-28 16:28:31 +02:00
parent 5a3f871c58
commit c3aff92cd4
1 changed files with 5 additions and 3 deletions

View File

@ -2095,10 +2095,12 @@ public class DataManagementPlanManager {
if (grantReferenceHead.equals("openaire")) {
String grantReferenceTail = dmp.getGrant().getReference().split(":")[3];
DoiFunder doiFunder = this.apiContext.getOperationsContext().getDatabaseRepository().getDoiFunderDao().findFunderByName(dmp.getGrant().getFunder().getLabel());
if (doiFunder != null) {
String finalId = doiFunder.getDoi() + "::" + grantReferenceTail;
dataBuilder.append(" \"grants\": [{\n");
dataBuilder.append(" \t\t\"id\": \"").append(finalId).append("\"\n}],\n");
}
}
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");