@Override public PeopleAssignments newPeopleAssignments() { return new PeopleAssignmentsImpl(); }
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); } }
peopleAssignments = new PeopleAssignmentsImpl(); peopleAssignments.readExternal( in );
@Override public PeopleAssignments newPeopleAssignments() { return new PeopleAssignmentsImpl(); }
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); } }
peopleAssignments = new PeopleAssignmentsImpl(); peopleAssignments.readExternal( in );
@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())); }
@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 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 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())); }
@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()); } }