Fix issue when creating new dataset profile

This commit is contained in:
George Kalampokis 2021-04-12 10:49:22 +03:00
parent aca31dc9da
commit 27bf69268e
1 changed files with 6 additions and 4 deletions

View File

@ -286,11 +286,13 @@ public class DatasetProfileManager {
apiContext.getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile1);
});
}
if (entity.getUsers() != null && !entity.getUsers().isEmpty()) {
entity.getUsers().stream().filter(userDatasetProfile -> model.getUsers().stream().filter(userInfoListingModel -> userDatasetProfile.getUser().getId().equals(userInfoListingModel.getId())).count() == 0).forEach(userDatasetProfile -> {
userDatasetProfile.setRole(2);
apiContext.getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile);
});
}
}
public void retrieveUsers(DatasetProfile entity, eu.eudat.models.data.admin.composite.DatasetProfile model) {
if (entity.getUsers() != null && !entity.getUsers().isEmpty()) {