Fix issue when creating new DMPs
This commit is contained in:
parent
4a7a947b66
commit
2329ad8bed
|
@ -760,6 +760,11 @@ public class DataManagementPlanManager {
|
|||
criteria.setReference(grant.getReference());
|
||||
eu.eudat.data.entities.Grant grantEntity = grantDao.getWithCriteria(criteria).getSingleOrDefault();
|
||||
if (grantEntity != null) grant.setId(grantEntity.getId());
|
||||
else {
|
||||
grant.setType(Grant.GrantType.EXTERNAL.getValue());
|
||||
grant.setCreationUser(null);
|
||||
grantDao.createOrUpdate(grant);
|
||||
}
|
||||
}
|
||||
else {
|
||||
grant.setType(Grant.GrantType.EXTERNAL.getValue());
|
||||
|
@ -777,6 +782,9 @@ public class DataManagementPlanManager {
|
|||
criteria.setReference(funder.getReference());
|
||||
eu.eudat.data.entities.Funder funderEntity = funderDao.getWithCritetia(criteria).getSingleOrDefault();
|
||||
if (funderEntity != null) funder.setId(funderEntity.getId());
|
||||
else {
|
||||
funderDao.createOrUpdate(funder);
|
||||
}
|
||||
}
|
||||
else {
|
||||
funderDao.createOrUpdate(funder);
|
||||
|
@ -792,6 +800,11 @@ public class DataManagementPlanManager {
|
|||
criteria.setReference(project.getReference());
|
||||
eu.eudat.data.entities.Project projectEntity = projectDao.getWithCritetia(criteria).getSingleOrDefault();
|
||||
if (projectEntity != null) project.setId(projectEntity.getId());
|
||||
else {
|
||||
project.setType(Project.ProjectType.EXTERNAL.getValue());
|
||||
if (project.getId() == null) project.setId(UUID.randomUUID());
|
||||
projectDao.createOrUpdate(project);
|
||||
}
|
||||
}
|
||||
else {
|
||||
project.setType(Project.ProjectType.EXTERNAL.getValue());
|
||||
|
|
Loading…
Reference in New Issue