When new version is made keep all it's contributors

This commit is contained in:
George Kalampokis 2021-07-06 16:56:37 +03:00
parent 1c22ed2321
commit d603fed61f
1 changed files with 10 additions and 0 deletions

View File

@ -632,6 +632,16 @@ public class DataManagementPlanManager {
copyDatasets(newDmp, databaseRepository.getDatasetDao());
databaseRepository
.getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), oldDmp.getId()))
.toList().stream().forEach(userDMP -> {
UserDMP temp = new UserDMP();
temp.setUser(userDMP.getUser());
temp.setRole(userDMP.getRole());
temp.setDmp(newDmp);
apiContext.getOperationsContext().getDatabaseRepository().getUserDmpDao().createOrUpdate(temp);
});
newDmp.setUsers(new HashSet<>(databaseRepository.getUserDmpDao().asQueryable().where((builder, root) -> builder.equal(root.get("dmp").get("id"), newDmp.getId())).toList()));
DatasetCriteria criteria1 = new DatasetCriteria();