use of org.kie.server.services.taskassigning.planning.util.UserUtil in project droolsjbpm-integration by kiegroup.
the class SolutionChangesBuilder method addUserChanges.
private void addUserChanges(final Map<String, User> usersById, final List<AddUserProblemFactChange> newUserChanges, final List<ProblemFactChange<TaskAssigningSolution>> updateUserChanges) {
final Set<String> updatedUserIds = new HashSet<>();
filterDuplicates(externalUserList).filter(externalUser -> !IS_PLANNING_USER.test(externalUser.getId())).map(UserUtil::fromExternalUser).forEach(user -> {
final User previousUser = usersById.get(user.getEntityId());
updatedUserIds.add(user.getEntityId());
if (previousUser == null) {
newUserChanges.add(new AddUserProblemFactChange(user));
} else if (!equalsByProperties(previousUser, user)) {
updateUserChanges.add(new UserPropertyChangeProblemFactChange(previousUser, true, user.getAttributes(), user.getAllLabelValues(), user.getGroups()));
}
});
usersById.values().stream().filter(user -> !IS_PLANNING_USER.test(user.getEntityId())).filter(user -> !updatedUserIds.contains(user.getEntityId())).filter(User::isEnabled).forEach(user -> updateUserChanges.add(new DisableUserProblemFactChange(user)));
}
Aggregations