Fetching funders on grants for dmps for public API
This commit is contained in:
parent
b00b048632
commit
e6cba30e4c
|
@ -79,7 +79,15 @@ public class GrantPublicOverviewModel {
|
|||
}
|
||||
|
||||
public static GrantPublicOverviewModel fromDmpReferences(List<DmpReference> dmpReferences) {
|
||||
FunderPublicOverviewModel funder = null;
|
||||
for (DmpReference dmpReference : dmpReferences) {
|
||||
if (dmpReference.getReference().getType() == ReferenceType.Funder) {
|
||||
funder = new FunderPublicOverviewModel();
|
||||
Reference reference = dmpReference.getReference();
|
||||
funder.setId(reference.getId());
|
||||
funder.setLabel(reference.getLabel());
|
||||
continue;
|
||||
}
|
||||
if (dmpReference.getReference().getType() != ReferenceType.Grants)
|
||||
continue;
|
||||
GrantPublicOverviewModel model = new GrantPublicOverviewModel();
|
||||
|
@ -88,6 +96,7 @@ public class GrantPublicOverviewModel {
|
|||
model.setDescription(reference.getDescription());
|
||||
model.setAbbreviation(reference.getAbbreviation());
|
||||
model.setLabel(reference.getLabel());
|
||||
model.setFunder(funder);
|
||||
Field startDate = reference.getDefinition().getFields().stream().filter(x -> x.getCode().equals("startDate")).toList().get(0);
|
||||
if (startDate != null) model.setStartDate(Date.from(Instant.parse(startDate.getValue())));
|
||||
Field endDate = reference.getDefinition().getFields().stream().filter(x -> x.getCode().equals("endDate")).toList().get(0);
|
||||
|
|
Loading…
Reference in New Issue