When checking for pre-existing Funders, grants and project get the last modified if found
This commit is contained in:
parent
2c765dbc52
commit
37a1253b08
|
@ -760,7 +760,7 @@ public class DataManagementPlanManager {
|
||||||
GrantCriteria criteria = new GrantCriteria();
|
GrantCriteria criteria = new GrantCriteria();
|
||||||
if (grant.getReference() != null) {
|
if (grant.getReference() != null) {
|
||||||
criteria.setReference(grant.getReference());
|
criteria.setReference(grant.getReference());
|
||||||
eu.eudat.data.entities.Grant grantEntity = grantDao.getWithCriteria(criteria).getSingleOrDefault();
|
eu.eudat.data.entities.Grant grantEntity = grantDao.getWithCriteria(criteria).toList().stream().max(Comparator.comparing(grant1 -> grant1.getModified().getTime())).orElse(null);
|
||||||
if (grantEntity != null) grant.setId(grantEntity.getId());
|
if (grantEntity != null) grant.setId(grantEntity.getId());
|
||||||
else {
|
else {
|
||||||
grant.setType(Grant.GrantType.EXTERNAL.getValue());
|
grant.setType(Grant.GrantType.EXTERNAL.getValue());
|
||||||
|
@ -782,7 +782,7 @@ public class DataManagementPlanManager {
|
||||||
FunderCriteria criteria = new FunderCriteria();
|
FunderCriteria criteria = new FunderCriteria();
|
||||||
if (funder.getReference() != null) {
|
if (funder.getReference() != null) {
|
||||||
criteria.setReference(funder.getReference());
|
criteria.setReference(funder.getReference());
|
||||||
eu.eudat.data.entities.Funder funderEntity = funderDao.getWithCritetia(criteria).getSingleOrDefault();
|
eu.eudat.data.entities.Funder funderEntity = funderDao.getWithCritetia(criteria).toList().stream().max(Comparator.comparing(funder1 -> funder1.getModified().getTime())).orElse(null);
|
||||||
if (funderEntity != null) funder.setId(funderEntity.getId());
|
if (funderEntity != null) funder.setId(funderEntity.getId());
|
||||||
else {
|
else {
|
||||||
funderDao.createOrUpdate(funder);
|
funderDao.createOrUpdate(funder);
|
||||||
|
@ -800,7 +800,7 @@ public class DataManagementPlanManager {
|
||||||
ProjectCriteria criteria = new ProjectCriteria();
|
ProjectCriteria criteria = new ProjectCriteria();
|
||||||
if (project.getReference() != null) {
|
if (project.getReference() != null) {
|
||||||
criteria.setReference(project.getReference());
|
criteria.setReference(project.getReference());
|
||||||
eu.eudat.data.entities.Project projectEntity = projectDao.getWithCritetia(criteria).getSingleOrDefault();
|
eu.eudat.data.entities.Project projectEntity = projectDao.getWithCritetia(criteria).toList().stream().max(Comparator.comparing(project1 -> project1.getModified().getTime())).orElse(null);
|
||||||
if (projectEntity != null) project.setId(projectEntity.getId());
|
if (projectEntity != null) project.setId(projectEntity.getId());
|
||||||
else {
|
else {
|
||||||
project.setType(Project.ProjectType.EXTERNAL.getValue());
|
project.setType(Project.ProjectType.EXTERNAL.getValue());
|
||||||
|
|
Loading…
Reference in New Issue