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,9 +2095,11 @@ 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());
String finalId = doiFunder.getDoi() + "::" + grantReferenceTail;
dataBuilder.append(" \"grants\": [{\n");
dataBuilder.append(" \t\t\"id\": \"").append(finalId).append("\"\n}],\n");
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");