PeopleAssignmentHelper { @SuppressWarnings("unchecked") protected void assignBusinessAdministrators(WorkItem workItem, PeopleAssignments peopleAssignments) { List<OrganizationalEntity> businessAdministrators = peopleAssignments.getBusinessAdministrators(); Object businessAdminGroupIds = adjustParam(workItem.getParameter(BUSINESSADMINISTRATOR_GROUP_ID), groupFilter); Object businessAdministratorIds = adjustParam(workItem.getParameter(BUSINESSADMINISTRATOR_ID), userFilter); if (!hasAdminAssigned(businessAdministrators)) { User administrator = TaskModelProvider.getFactory().newUser(); ((InternalOrganizationalEntity) administrator).setId(administratorUser); businessAdministrators.add(administrator); Group adminGroup = TaskModelProvider.getFactory().newGroup(); ((InternalOrganizationalEntity) adminGroup).setId(administratorGroup); businessAdministrators.add(adminGroup); } if (businessAdministratorIds instanceof Collection) { processPeopleAssignments((Collection<OrganizationalEntity>)businessAdministratorIds, businessAdministrators); } else { processPeopleAssignments((String)businessAdministratorIds, businessAdministrators, true); } if (businessAdminGroupIds instanceof Collection) { processPeopleAssignments((Collection<OrganizationalEntity>)businessAdminGroupIds, businessAdministrators); } else { processPeopleAssignments((String)businessAdminGroupIds, businessAdministrators, false); } } 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 testAssignBusinessAdministrators() { String businessAdministratorId = "espiegelberg"; Task task = TaskModelProvider.getFactory().newTask(); PeopleAssignments peopleAssignments = peopleAssignmentHelper.getNullSafePeopleAssignments(task); WorkItem workItem = new WorkItemImpl(); workItem.setParameter(PeopleAssignmentHelper.BUSINESSADMINISTRATOR_ID, businessAdministratorId); peopleAssignmentHelper.assignBusinessAdministrators(workItem, peopleAssignments); assertEquals(3, peopleAssignments.getBusinessAdministrators().size()); OrganizationalEntity organizationalEntity1 = peopleAssignments.getBusinessAdministrators().get(0); assertTrue(organizationalEntity1 instanceof User); assertEquals("Administrator", organizationalEntity1.getId()); OrganizationalEntity organizationalEntity2 = peopleAssignments.getBusinessAdministrators().get(1); assertTrue(organizationalEntity2 instanceof Group); assertEquals("Administrators", organizationalEntity2.getId()); OrganizationalEntity organizationalEntity3 = peopleAssignments.getBusinessAdministrators().get(2); assertTrue(organizationalEntity3 instanceof User); assertEquals(businessAdministratorId, organizationalEntity3.getId()); }