@Override public TaskAssignmentSummary getTaskAssignmentDetails(long taskId) { Task task = taskService.getTask(taskId); if (task != null) { List<OrganizationalEntity> potentialOwners = task.getPeopleAssignments().getPotentialOwners(); List<String> potOwnersString = new ArrayList<String>(); if (potentialOwners != null) { potOwnersString = getPotentialOwnersByTaskId(potentialOwners); } return new TaskAssignmentSummary(task.getId(),task.getName(),(task.getTaskData().getActualOwner() != null) ? task.getTaskData().getActualOwner() .getId() : "",potOwnersString); } return null; }
public String getTask(String containerId, Number taskId, boolean withInput, boolean withOutput, boolean withAssignments, String marshallingType) { containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); Task task = userTaskService.getTask(containerId, taskId.longValue()); if (task == null) { throw new TaskNotFoundException("No task found with id " + taskId);
@Test public void testAllowDelegateNoData() { final long takId = 1; final String userId = "user"; final String groupId = "group"; final TaskImpl task = new TaskImpl(); final TaskDataImpl taskData = new TaskDataImpl(); task.setTaskData(taskData); final PeopleAssignmentsImpl peopleAssignments = new PeopleAssignmentsImpl(); task.setPeopleAssignments(peopleAssignments); when(taskService.getTask(takId)).thenReturn(task); assertFalse(taskOperationsService.allowDelegate(takId, userId, Collections.singleton(groupId))); }
@Test public void testAllowDelegateUserInPotentialOwner() { final long takId = 1; final String userId = "user"; final TaskImpl task = new TaskImpl(); task.setTaskData(new TaskDataImpl()); final PeopleAssignmentsImpl peopleAssignments = new PeopleAssignmentsImpl(); peopleAssignments.setPotentialOwners(Collections.<OrganizationalEntity>singletonList(new UserImpl(userId))); task.setPeopleAssignments(peopleAssignments); when(taskService.getTask(takId)).thenReturn(task); assertTrue(taskOperationsService.allowDelegate(takId, userId, Collections.<String>emptySet())); }
task.setId(TASK_ID); task.setTaskData(new TaskDataImpl()); doReturn(task).when(userTaskServiceMock).getTask(TASK_ID);
@Test public void testAllowDelegateGroupInBusinessAdministrators() { final long takId = 1; final String userId = "user"; final String groupId = "group"; final TaskImpl task = new TaskImpl(); task.setTaskData(new TaskDataImpl()); final PeopleAssignmentsImpl peopleAssignments = new PeopleAssignmentsImpl(); peopleAssignments.setBusinessAdministrators(Collections.<OrganizationalEntity>singletonList(new GroupImpl(groupId))); task.setPeopleAssignments(peopleAssignments); when(taskService.getTask(takId)).thenReturn(task); assertTrue(taskOperationsService.allowDelegate(takId, userId, Collections.singleton(groupId))); }
@Test public void testAllowDelegateStatusCompleted() { final long takId = 1; final TaskImpl task = new TaskImpl(); final TaskDataImpl taskData = new TaskDataImpl(); taskData.setStatus(Status.Completed); task.setTaskData(taskData); when(taskService.getTask(takId)).thenReturn(task); assertFalse(taskOperationsService.allowDelegate(takId, null, null)); }
@Test public void testAllowDelegateUserInBusinessAdministrators() { final long takId = 1; final String userId = "user"; final TaskImpl task = new TaskImpl(); task.setTaskData(new TaskDataImpl()); final PeopleAssignmentsImpl peopleAssignments = new PeopleAssignmentsImpl(); peopleAssignments.setBusinessAdministrators(Collections.<OrganizationalEntity>singletonList(new UserImpl(userId))); task.setPeopleAssignments(peopleAssignments); when(taskService.getTask(takId)).thenReturn(task); assertTrue(taskOperationsService.allowDelegate(takId, userId, Collections.<String>emptySet())); }
@Test public void testAllowDelegateGroupInPotentialOwner() { final long takId = 1; final String userId = "user"; final String groupId = "group"; final TaskImpl task = new TaskImpl(); task.setTaskData(new TaskDataImpl()); final PeopleAssignmentsImpl peopleAssignments = new PeopleAssignmentsImpl(); peopleAssignments.setPotentialOwners(Collections.<OrganizationalEntity>singletonList(new GroupImpl(groupId))); task.setPeopleAssignments(peopleAssignments); when(taskService.getTask(takId)).thenReturn(task); assertTrue(taskOperationsService.allowDelegate(takId, userId, Collections.singleton(groupId))); }
@Test public void testAllowDelegateInitiator() { final long takId = 1; final String userId = "user"; final TaskImpl task = new TaskImpl(); task.setTaskData(new TaskDataImpl()); final PeopleAssignmentsImpl peopleAssignments = new PeopleAssignmentsImpl(); peopleAssignments.setTaskInitiator(new UserImpl(userId)); task.setPeopleAssignments(peopleAssignments); when(taskService.getTask(takId)).thenReturn(task); assertTrue(taskOperationsService.allowDelegate(takId, userId, Collections.<String>emptySet())); }
@Test public void testAllowDelegateActualOwner() { final long takId = 1; final String userId = "user"; final TaskImpl task = new TaskImpl(); final TaskDataImpl taskData = new TaskDataImpl(); taskData.setActualOwner(new UserImpl(userId)); task.setTaskData(taskData); final PeopleAssignmentsImpl peopleAssignments = new PeopleAssignmentsImpl(); task.setPeopleAssignments(peopleAssignments); when(taskService.getTask(takId)).thenReturn(task); assertTrue(taskOperationsService.allowDelegate(takId, userId, Collections.<String>emptySet())); }
final Task task = taskService.getTask(taskId); if (task == null) { return false;
@Override public TaskSummary getTaskDetails(long taskId) { Task task = taskService.getTask(taskId); if (task != null) { List<OrganizationalEntity> potentialOwners = task.getPeopleAssignments().getPotentialOwners(); List<String> potOwnersString = getPotentialOwnersByTaskId(potentialOwners); return new TaskSummary(task.getId(), task.getName(), task.getDescription(), task.getTaskData().getStatus().name(), task.getPriority(), (task.getTaskData().getActualOwner() != null) ? task.getTaskData().getActualOwner() .getId() : "", (task.getTaskData().getCreatedBy() != null) ? task.getTaskData().getCreatedBy().getId() : "", task.getTaskData().getCreatedOn(), task.getTaskData().getActivationTime(), task.getTaskData() .getExpirationTime(), task.getTaskData().getProcessId(), task.getTaskData().getProcessSessionId(), task.getTaskData().getProcessInstanceId(), task.getTaskData().getDeploymentId() , (int) task.getTaskData().getParentId(),false,potOwnersString); } return null; }