PeopleAssignmentHelper { public void handlePeopleAssignments(WorkItem workItem, InternalTask task, InternalTaskData taskData) { InternalPeopleAssignments peopleAssignments = getNullSafePeopleAssignments(task); assignActors(workItem, peopleAssignments, taskData); assignGroups(workItem, peopleAssignments); assignBusinessAdministrators(workItem, peopleAssignments); assignTaskStakeholders(workItem, peopleAssignments); assignExcludedOwners(workItem, peopleAssignments); assignRecipients(workItem, peopleAssignments); task.setPeopleAssignments(peopleAssignments); } 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 testHandlePeopleAssignments() { InternalTask task = (InternalTask) TaskModelProvider.getFactory().newTask(); InternalTaskData taskData = (InternalTaskData) TaskModelProvider.getFactory().newTaskData(); InternalPeopleAssignments peopleAssignment = peopleAssignmentHelper.getNullSafePeopleAssignments(task); assertNotNull(peopleAssignment); assertEquals(0, peopleAssignment.getPotentialOwners().size()); assertEquals(0, peopleAssignment.getBusinessAdministrators().size()); assertEquals(0, peopleAssignment.getTaskStakeholders().size()); String actorId = "espiegelberg"; String taskStakeholderId = "drmary"; String businessAdministratorId = "drbug"; String businessAdministratorGroupId = "Super users"; String excludedOwnerId = "john"; String recipientId = "mary"; WorkItem workItem = new WorkItemImpl(); workItem.setParameter(PeopleAssignmentHelper.ACTOR_ID, actorId); workItem.setParameter(PeopleAssignmentHelper.TASKSTAKEHOLDER_ID, taskStakeholderId); workItem.setParameter(PeopleAssignmentHelper.BUSINESSADMINISTRATOR_ID, businessAdministratorId); workItem.setParameter(PeopleAssignmentHelper.BUSINESSADMINISTRATOR_GROUP_ID, businessAdministratorGroupId); workItem.setParameter(PeopleAssignmentHelper.EXCLUDED_OWNER_ID, excludedOwnerId); workItem.setParameter(PeopleAssignmentHelper.RECIPIENT_ID, recipientId); peopleAssignmentHelper.handlePeopleAssignments(workItem, task, taskData); List<OrganizationalEntity> potentialOwners = task.getPeopleAssignments().getPotentialOwners(); assertEquals(1, potentialOwners.size()); assertEquals(actorId, potentialOwners.get(0).getId()); List<OrganizationalEntity> businessAdministrators = task.getPeopleAssignments().getBusinessAdministrators(); assertEquals(4, businessAdministrators.size()); assertEquals("Administrator", businessAdministrators.get(0).getId()); assertEquals("Administrators", businessAdministrators.get(1).getId()); assertEquals(businessAdministratorId, businessAdministrators.get(2).getId()); assertEquals(businessAdministratorGroupId, businessAdministrators.get(3).getId()); List<OrganizationalEntity> taskStakehoders = ((InternalPeopleAssignments) task.getPeopleAssignments()).getTaskStakeholders(); assertEquals(1, taskStakehoders.size()); assertEquals(taskStakeholderId, taskStakehoders.get(0).getId()); List<OrganizationalEntity> excludedOwners = ((InternalPeopleAssignments) task.getPeopleAssignments()).getExcludedOwners(); assertEquals(1, excludedOwners.size()); assertEquals(excludedOwnerId, excludedOwners.get(0).getId()); List<OrganizationalEntity> recipients = ((InternalPeopleAssignments) task.getPeopleAssignments()).getRecipients(); assertEquals(1, recipients.size()); assertEquals(recipientId, recipients.get(0).getId()); }