When deleting DMP update dataset indexes of previous versions
This commit is contained in:
parent
697a8908e1
commit
aca78cac8e
|
@ -725,6 +725,18 @@ public class DataManagementPlanManager {
|
||||||
DMP oldDmp = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(uuid);
|
DMP oldDmp = apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().find(uuid);
|
||||||
oldDmp.setStatus(DMP.DMPStatus.DELETED.getValue());
|
oldDmp.setStatus(DMP.DMPStatus.DELETED.getValue());
|
||||||
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(oldDmp);
|
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().createOrUpdate(oldDmp);
|
||||||
|
DataManagementPlanCriteria criteria1 = new DataManagementPlanCriteria();
|
||||||
|
criteria1.setAllVersions(true);
|
||||||
|
criteria1.setGroupIds(Collections.singletonList(oldDmp.getGroupId()));
|
||||||
|
apiContext.getOperationsContext().getDatabaseRepository().getDmpDao().getWithCriteria(criteria1).toList().forEach(dmp -> {
|
||||||
|
for (Dataset dataset: dmp.getDataset()) {
|
||||||
|
try {
|
||||||
|
datasetManager.updateTags(apiContext.getOperationsContext().getDatasetRepository(), new DatasetWizardModel().fromDataModel(dataset));
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createResearchersIfTheyDontExist(DMP newDmp, ResearcherDao researcherRepository, UserInfo user) {
|
private void createResearchersIfTheyDontExist(DMP newDmp, ResearcherDao researcherRepository, UserInfo user) {
|
||||||
|
|
Loading…
Reference in New Issue