UserTaskAdminServiceImpl implements UserTaskAdminService { @Override public void addExcludedOwners(long taskId, boolean removeExisting, OrganizationalEntity... orgEntities) throws TaskNotFoundException { addExcludedOwners(null, taskId, removeExisting, orgEntities); } UserTaskAdminServiceImpl(); void setUserTaskService(UserTaskService userTaskService); void setRuntimeDataService(RuntimeDataService runtimeDataService); void setIdentityProvider(IdentityProvider identityProvider); void setCommandService(TransactionalCommandService commandService); @Override void addPotentialOwners(long taskId, boolean removeExisting, OrganizationalEntity... orgEntities); @Override void addPotentialOwners(String deploymentId, long taskId, boolean removeExisting, OrganizationalEntity... orgEntities); @Override void addExcludedOwners(long taskId, boolean removeExisting, OrganizationalEntity... orgEntities); @Override void addExcludedOwners(String deploymentId, long taskId, boolean removeExisting, OrganizationalEntity... orgEntities); @Override void addBusinessAdmins(long taskId, boolean removeExisting, OrganizationalEntity... orgEntities); @Override void addBusinessAdmins(String deploymentId, long taskId, boolean removeExisting, OrganizationalEntity... orgEntities); @Override void removePotentialOwners(long taskId, OrganizationalEntity... orgEntities); @Override void removePotentialOwners(String deploymentId, long taskId, OrganizationalEntity... orgEntities); @Override void removeExcludedOwners(long taskId, OrganizationalEntity... orgEntities); @Override void removeExcludedOwners(String deploymentId, long taskId, OrganizationalEntity... orgEntities); @Override void removeBusinessAdmins(long taskId, OrganizationalEntity... orgEntities); @Override void removeBusinessAdmins(String deploymentId, long taskId, OrganizationalEntity... orgEntities); @Override void addTaskInput(long taskId, String name, Object value); @Override void addTaskInput(String deploymentId, long taskId, String name, Object value); @Override void addTaskInputs(long taskId, Map<String, Object> data); @Override void addTaskInputs(String deploymentId, long taskId, Map<String, Object> data); @Override void removeTaskInputs(long taskId, String... name); @Override void removeTaskInputs(String deploymentId, long taskId, String... name); @Override void removeTaskOutputs(long taskId, String... name); @Override void removeTaskOutputs(String deploymentId, long taskId, String... name); @Override Long reassignWhenNotStarted(long taskId, String timeExpression, OrganizationalEntity... orgEntities); @Override Long reassignWhenNotStarted(String deploymentId, long taskId, String timeExpression, OrganizationalEntity... orgEntities); @Override Long reassignWhenNotCompleted(long taskId, String timeExpression, OrganizationalEntity... orgEntities); @Override Long reassignWhenNotCompleted(String deploymentId, long taskId, String timeExpression, OrganizationalEntity... orgEntities); @Override Long notifyWhenNotStarted(long taskId, String timeExpression, Notification notification); @Override Long notifyWhenNotStarted(String deploymentId, long taskId, String timeExpression, Notification notification); @Override Long notifyWhenNotCompleted(long taskId, String timeExpression, Notification notification); @Override Long notifyWhenNotCompleted(String deploymentId, long taskId, String timeExpression, Notification notification); @Override Collection<TaskReassignment> getTaskReassignments(long taskId, boolean activeOnly); @Override Collection<TaskReassignment> getTaskReassignments(String deploymentId, long taskId, boolean activeOnly); @Override Collection<TaskNotification> getTaskNotifications(long taskId, boolean activeOnly); @Override Collection<TaskNotification> getTaskNotifications(String deploymentId, long taskId, boolean activeOnly); @Override void cancelNotification(long taskId, long notificationId); @Override void cancelNotification(String deploymentId, long taskId, long notificationId); @Override void cancelReassignment(long taskId, long reassignmentId); @Override void cancelReassignment(String deploymentId, long taskId, long reassignmentId); @Override EmailNotification buildEmailNotification(String subjectStr, List<OrganizationalEntity> recipients, String bodyStr, String fromStr, String replyToStr); @Override List<ExecutionError> getErrors(boolean includeAcknowledged, QueryContext queryContext); @Override List<ExecutionError> getErrorsByTaskId(long taskId, boolean includeAcknowledged, QueryContext queryContext); @Override List<ExecutionError> getErrorsByTaskName(String taskName, boolean includeAcknowledged, QueryContext queryContext); @Override List<ExecutionError> getErrorsByTaskName(String processId, String taskName, boolean includeAcknowledged, QueryContext queryContext); @Override List<ExecutionError> getErrorsByTaskName(String deploymentId, String processId, String taskName, boolean includeAcknowledged, QueryContext queryContext); @Override void acknowledgeError(String... errorId); @Override ExecutionError getError(String errorId); static final int POT_OWNER; static final int EXCL_OWNER; static final int ADMIN; }
@Test public void testAddExcludedOwners() { processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument"); Assertions.assertThat(processInstanceId).isNotNull(); List<TaskSummary> tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter()); Assertions.assertThat(tasks).hasSize(1); TaskSummary task = tasks.get(0); userTaskService.release(task.getId(), "salaboy"); userTaskAdminService.addExcludedOwners(task.getId(), false, factory.newUser("salaboy")); List<TaskEvent> events = runtimeDataService.getTaskEvents(task.getId(), new QueryFilter()); Assertions.assertThat(events).hasSize(4); TaskEvent updatedEvent = events.get(3); Assertions.assertThat(updatedEvent.getMessage()).isEqualTo("Excluded owners [salaboy] have been added"); tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter()); Assertions.assertThat(tasks).hasSize(0); tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("john", new QueryFilter()); Assertions.assertThat(tasks).hasSize(0); userTaskAdminService.addExcludedOwners(task.getId(), true, factory.newUser("john")); tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("salaboy", new QueryFilter()); Assertions.assertThat(tasks).hasSize(1); tasks = runtimeDataService.getTasksAssignedAsPotentialOwner("john", new QueryFilter()); Assertions.assertThat(tasks).hasSize(0); }