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