Allow to re insert users on Dataset profile

This commit is contained in:
George Kalampokis 2021-07-23 18:27:49 +03:00
parent 008b6321ea
commit 9da0f4e776
1 changed files with 4 additions and 0 deletions

View File

@ -289,6 +289,10 @@ public class DatasetProfileManager {
userDatasetProfile1.setRole(1);
apiContext.getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile1);
});
entity.getUsers().stream().filter(userDatasetProfile -> model.getUsers().stream().filter(userInfoListingModel -> userDatasetProfile.getUser().getId().equals(userInfoListingModel.getId())).count() > 0 && userDatasetProfile.getRole() == 2).forEach(userDatasetProfile -> {
userDatasetProfile.setRole(1);
apiContext.getOperationsContext().getDatabaseRepository().getUserDatasetProfileDao().createOrUpdate(userDatasetProfile);
});
}
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 -> {