Fix issue with project creation
This commit is contained in:
parent
8899e1ba65
commit
58ecadd79b
|
@ -859,20 +859,23 @@ public class DataManagementPlanManager {
|
|||
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());
|
||||
else {
|
||||
project.setType(Project.ProjectType.EXTERNAL.getValue());
|
||||
if (project.getId() == null) project.setId(UUID.randomUUID());
|
||||
projectDao.createOrUpdate(project);
|
||||
metricsManager.increaseValue(MetricNames.PROJECT, 1, null);
|
||||
createExternalProject(project, projectDao);
|
||||
}
|
||||
}
|
||||
else {
|
||||
createExternalProject(project, projectDao);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void createExternalProject(Project project, ProjectDao projectDao) {
|
||||
if (project.getStartdate() == null) project.setStartdate(new Date());
|
||||
if (project.getEnddate() == null) project.setEnddate(new Date());
|
||||
project.setType(Project.ProjectType.EXTERNAL.getValue());
|
||||
if (project.getId() == null) project.setId(UUID.randomUUID());
|
||||
projectDao.createOrUpdate(project);
|
||||
metricsManager.increaseValue(MetricNames.PROJECT, 1, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void copyDatasets(DMP newDmp, DatasetDao datasetDao) {
|
||||
List<CompletableFuture<Dataset>> futures = new LinkedList<>();
|
||||
|
|
Loading…
Reference in New Issue