public TaskFluent() { if (task == null) { task = new TaskImpl(); task.setTaskData(new TaskDataImpl()); assignments = new PeopleAssignmentsImpl(); task.setPeopleAssignments(assignments); names = new ArrayList<I18NText>(); task.setNames(names); descriptions = new ArrayList<I18NText>(); task.setDescriptions(descriptions); subjects = new ArrayList<I18NText>(); task.setSubjects(subjects); } }
public TaskFluent setWorkItemId(long workItemId){ ((TaskDataImpl)task.getTaskData()).setWorkItemId(workItemId); return this; }
public TaskFluent setName(String name) { task.setName(name); return this; }
@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 //https://issues.jboss.org/browse/JBPM-5282 public void testAddGetTaskByWorkItemIdCommand() { JaxbCommandsResponse jaxbCommandsResponse = new JaxbCommandsResponse(); String taskName = "task name"; GetTaskByWorkItemIdCommand command = new GetTaskByWorkItemIdCommand(10L); TaskImpl task = new TaskImpl(); task.setName(taskName); task.setPeopleAssignments(new PeopleAssignmentsImpl()); task.setTaskData(new TaskDataImpl()); jaxbCommandsResponse.addResult(task, 0, command); List<JaxbCommandResponse<?>> responses = jaxbCommandsResponse.getResponses(); Assert.assertEquals(1, responses.size()); @SuppressWarnings("unchecked") JaxbCommandResponse<JaxbTaskResponse> response = (JaxbCommandResponse<JaxbTaskResponse>)responses.get(0); JaxbTaskResponse jaxbTaskResponse = response.getResult(); Assert.assertEquals(taskName, jaxbTaskResponse.getName()); Assert.assertNotNull(jaxbTaskResponse.getPeopleAssignments()); Assert.assertNotNull(jaxbTaskResponse.getTaskData()); } }
@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)); }
@Override public Task newTask() { return new TaskImpl(); }
String name = "EggHunting"; taskImpl = addTask(workItemId, procInstId, busAdmin, potOwner, name, null); firstTaskId = taskImpl.getId(); taskIds.add(firstTaskId); assertEquals( potOwner, taskImpl.getTaskData().getActualOwner().getId() ); tasks[0] = taskImpl; .businessAdmin(busAdmin) .potentialOwner(potOwner) .taskId(taskImpl.getId()) .ascending(OrderBy.taskId); List<TaskSummary> results = queryBuilder.build().getResultList(); String potOwner = "Hideo"; taskImpl = addTask(workItemId, procInstId, busAdmin, potOwner, "This is my task name", null); taskIds.add(taskImpl.getId()); assertEquals( potOwner, taskImpl.getTaskData().getActualOwner().getId() ); taskService.start(taskImpl.getId(), potOwner); tasks[1] = (Task) taskService.getTaskById(taskImpl.getId()); statuses.add(tasks[1].getTaskData().getStatus()); .businessAdmin(busAdmin) .potentialOwner(potOwner) .taskId(taskImpl.getId()); List<TaskSummary> results = queryBuilder.build().getResultList(); assertEquals("List of tasks", 1, results.size());
public TaskFluent addI18NDescription(String language, String description){ task.getDescriptions().add(new I18NTextImpl(language, description)); return this; }
@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())); }
@Override public Task newTask() { return new TaskImpl(); }
String potOwner = "Maelcum"; taskImpl = addTask(workItemId, procInstId, busAdmin, potOwner, "This is my task name", null); firstTaskId = taskImpl.getId(); taskIds.add(firstTaskId); assertEquals( potOwner, taskImpl.getTaskData().getActualOwner().getId() ); tasks[0] = taskImpl; String potOwner = "Hideo"; taskImpl = addTask(workItemId, procInstId, busAdmin, potOwner, "This is my task name", null); taskIds.add(taskImpl.getId()); assertEquals( potOwner, taskImpl.getTaskData().getActualOwner().getId() ); taskService.start(taskImpl.getId(), potOwner); tasks[1] = (Task) taskService.getTaskById(taskImpl.getId()); statuses.add(tasks[1].getTaskData().getStatus()); taskImpl = addTask(workItemId, procInstId, busAdmin, potOwner, name, deploymentId); assertEquals( potOwner, taskImpl.getTaskData().getActualOwner().getId() ); taskService.start(taskImpl.getId(), potOwner); taskService.fail(taskImpl.getId(), busAdmin, null);
public TaskFluent addI18NDescription(String language, String description){ task.getDescriptions().add(new I18NTextImpl(language, description)); return this; }
@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())); }
public TaskFluent() { if (task == null) { task = new TaskImpl(); task.setTaskData(new TaskDataImpl()); assignments = new PeopleAssignmentsImpl(); task.setPeopleAssignments(assignments); names = new ArrayList<I18NText>(); task.setNames(names); descriptions = new ArrayList<I18NText>(); task.setDescriptions(descriptions); subjects = new ArrayList<I18NText>(); task.setSubjects(subjects); } }
public TaskFluent setWorkItemId(String deploymentId){ ((TaskDataImpl)task.getTaskData()).setDeploymentId(deploymentId); return this; }
public TaskFluent setName(String name) { task.setName(name); return this; }
@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))); }
InternalTask task = new TaskImpl(); task.setId(TASK_ID); task.setTaskData(new TaskDataImpl());