CCM NG/ccm-cms: Removing roles from task
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4630 8810af33-2d31-482b-a856-94f89814c4df
parent
c438e8fc5c
commit
61c6859a3a
|
|
@ -376,7 +376,7 @@ public class WorkflowAdminPaneController {
|
|||
final Role role = roleRepo
|
||||
.findById(Long.parseLong(roleId))
|
||||
.orElseThrow(() -> new IllegalArgumentException(String.format(
|
||||
"No Role with ID %d in the database. Where did that ID come from?",
|
||||
"No Role with ID %s in the database. Where did that ID come from?",
|
||||
roleId)));
|
||||
|
||||
final CmsTask theTask = (CmsTask) taskRepo
|
||||
|
|
|
|||
|
|
@ -111,12 +111,14 @@ public class AssignableTaskManager {
|
|||
"Can't retract a task from role null.");
|
||||
}
|
||||
|
||||
final List<TaskAssignment> result = task.getAssignments().stream()
|
||||
.filter(assigned -> role.equals(assigned.getRole()))
|
||||
.collect(Collectors.toList());
|
||||
final Optional<TaskAssignment> result = task
|
||||
.getAssignments()
|
||||
.stream()
|
||||
.filter(assigned -> role.getRoleId() == assigned.getRole().getRoleId())
|
||||
.findAny();
|
||||
|
||||
if (!result.isEmpty()) {
|
||||
final TaskAssignment assignment = result.get(0);
|
||||
if (result.isPresent()) {
|
||||
final TaskAssignment assignment = result.get();
|
||||
task.removeAssignment(assignment);
|
||||
role.removeAssignedTask(assignment);
|
||||
entityManager.remove(assignment);
|
||||
|
|
|
|||
Loading…
Reference in New Issue