public TaskFluent addPotentialGroup(String groupId) { if(assignments.getPotentialOwners().isEmpty()){ List<OrganizationalEntity> potentialOwners = new ArrayList<OrganizationalEntity>(); assignments.setPotentialOwners(potentialOwners); } assignments.getPotentialOwners().add(new GroupImpl(groupId)); return this; }
public TaskFluent addPotentialUser(String userId) { if(assignments.getPotentialOwners().isEmpty()){ List<OrganizationalEntity> potentialOwners = new ArrayList<OrganizationalEntity>(); assignments.setPotentialOwners(potentialOwners); } assignments.getPotentialOwners().add(new UserImpl(userId)); return this; }
public TaskFluent addPotentialUser(String userId) { if(assignments.getPotentialOwners().isEmpty()){ List<OrganizationalEntity> potentialOwners = new ArrayList<OrganizationalEntity>(); assignments.setPotentialOwners(potentialOwners); } assignments.getPotentialOwners().add(new UserImpl(userId)); return this; }
public TaskFluent addPotentialGroup(String groupId) { if(assignments.getPotentialOwners().isEmpty()){ List<OrganizationalEntity> potentialOwners = new ArrayList<OrganizationalEntity>(); assignments.setPotentialOwners(potentialOwners); } assignments.getPotentialOwners().add(new GroupImpl(groupId)); 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())); }
@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))); }