PeopleAssignmentHelper { @SuppressWarnings("unchecked") protected void assignActors(WorkItem workItem, PeopleAssignments peopleAssignments, InternalTaskData taskData) { List<OrganizationalEntity> potentialOwners = peopleAssignments.getPotentialOwners(); Object actorIds = adjustParam(workItem.getParameter(ACTOR_ID), userFilter); if (actorIds instanceof Collection) { processPeopleAssignments((Collection<OrganizationalEntity>)actorIds, potentialOwners); } else { processPeopleAssignments((String)actorIds, potentialOwners, true); } } PeopleAssignmentHelper();  PeopleAssignmentHelper(String separator);  PeopleAssignmentHelper(String adminUser, String adminGroup);  PeopleAssignmentHelper(CaseData caseFile); void handlePeopleAssignments(WorkItem workItem, InternalTask task, InternalTaskData taskData); static final String ACTOR_ID; static final String GROUP_ID; static final String BUSINESSADMINISTRATOR_ID; static final String BUSINESSADMINISTRATOR_GROUP_ID; static final String TASKSTAKEHOLDER_ID; static final String EXCLUDED_OWNER_ID; static final String RECIPIENT_ID; static final String DEFAULT_ADMIN_USER; static final String DEFAULT_ADMIN_GROUP; }
@Test public void testAssignActors() { String actorId = "espiegelberg"; Task task = TaskModelProvider.getFactory().newTask(); InternalTaskData taskData = (InternalTaskData) TaskModelProvider.getFactory().newTaskData(); PeopleAssignments peopleAssignments = peopleAssignmentHelper.getNullSafePeopleAssignments(task); WorkItem workItem = new WorkItemImpl(); workItem.setParameter(PeopleAssignmentHelper.ACTOR_ID, actorId); peopleAssignmentHelper.assignActors(workItem, peopleAssignments, taskData); OrganizationalEntity organizationalEntity1 = peopleAssignments.getPotentialOwners().get(0); assertTrue(organizationalEntity1 instanceof User); assertEquals(actorId, organizationalEntity1.getId()); assertNull(taskData.getCreatedBy()); workItem = new WorkItemImpl(); peopleAssignments = peopleAssignmentHelper.getNullSafePeopleAssignments(task); workItem.setParameter(PeopleAssignmentHelper.ACTOR_ID, actorId + ", drbug "); peopleAssignmentHelper.assignActors(workItem, peopleAssignments, taskData); assertEquals(2, peopleAssignments.getPotentialOwners().size()); organizationalEntity1 = peopleAssignments.getPotentialOwners().get(0); assertEquals(actorId, organizationalEntity1.getId()); assertNull(taskData.getCreatedBy()); OrganizationalEntity organizationalEntity2 = peopleAssignments.getPotentialOwners().get(1); assertEquals("drbug", organizationalEntity2.getId()); workItem = new WorkItemImpl(); peopleAssignments = peopleAssignmentHelper.getNullSafePeopleAssignments(task); workItem.setParameter(PeopleAssignmentHelper.ACTOR_ID, ""); peopleAssignmentHelper.assignActors(workItem, peopleAssignments, taskData); assertEquals(0, peopleAssignments.getPotentialOwners().size()); }