Prevent duplicate researchers to be added when importing from RDA json
This commit is contained in:
parent
12587ee865
commit
314c62e1aa
|
@ -2,6 +2,7 @@ package eu.eudat.models.rda.mapper;
|
|||
|
||||
import eu.eudat.data.entities.*;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.logic.utilities.helpers.StreamDistinctBy;
|
||||
import eu.eudat.models.rda.Dmp;
|
||||
import eu.eudat.models.rda.DmpId;
|
||||
import net.minidev.json.JSONObject;
|
||||
|
@ -80,7 +81,7 @@ public class DmpRDAMapper {
|
|||
}
|
||||
}
|
||||
if (rda.getContributor() != null && !rda.getContributor().isEmpty()) {
|
||||
entity.setResearchers(rda.getContributor().stream().map(ContributorRDAMapper::toEntity).collect(Collectors.toSet()));
|
||||
entity.setResearchers(rda.getContributor().stream().map(ContributorRDAMapper::toEntity).filter(StreamDistinctBy.distinctByKey(Researcher::getReference)).collect(Collectors.toSet()));
|
||||
}
|
||||
entity.setCreated(rda.getCreated());
|
||||
entity.setModified(rda.getModified());
|
||||
|
|
Loading…
Reference in New Issue