use of org.kie.server.services.taskassigning.core.model.solver.realtime.DisableUserProblemFactChange 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)));
}
use of org.kie.server.services.taskassigning.core.model.solver.realtime.DisableUserProblemFactChange in project droolsjbpm-integration by kiegroup.
the class SolutionChangesBuilderTest method assertChange.
private void assertChange(List<ProblemFactChange<TaskAssigningSolution>> result, int index, DisableUserProblemFactChange expected) {
DisableUserProblemFactChange change = (DisableUserProblemFactChange) result.get(index);
assertUserEquals(expected.getUser(), change.getUser());
}
use of org.kie.server.services.taskassigning.core.model.solver.realtime.DisableUserProblemFactChange in project droolsjbpm-integration by kiegroup.
the class SolutionChangesBuilderTest method addDisableUserProblemFactChange.
@Test
public void addDisableUserProblemFactChange() {
List<User> userList = mockUserList(mockUser(USER1_ID));
List<org.kie.server.services.taskassigning.user.system.api.User> externalUserList = Collections.emptyList();
TaskAssigningSolution solution = mockSolution(Collections.emptyList(), userList);
List<ProblemFactChange<TaskAssigningSolution>> result = SolutionChangesBuilder.create().withSolution(solution).withTasks(Collections.emptyList()).withUserSystem(userSystemService).withUsersUpdate(externalUserList).withContext(context).build();
DisableUserProblemFactChange expected = new DisableUserProblemFactChange(userList.get(0));
assertChangeIsTheChangeSetId(result, 0);
assertChange(result, 1, expected);
}
Aggregations