PageControl pcp = WebUtility.getPageControl(request, "p");
log.trace("available page control: " + pca);
log.trace("pending page control: " + pcp);
SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
/* pending users are those on the right side of the "add
* to list" widget- awaiting association with the rolewhen the form's "ok" button is clicked. */
Integer[] pendingUserIds = SessionUtils.getList(request.getSession(), Constants.PENDING_USERS_SES_ATTR);
log.trace("getting pending users for role [" + roleId + "]");
SubjectCriteria c = new SubjectCriteria();
c.addFilterIds(pendingUserIds);
c.addFilterFsystem(false);
c.addFilterFactive(true);
c.fetchRoles(true);
c.addSortName(PageOrdering.ASC);
PageList<Subject> pendingUsers = subjectManager.findSubjectsByCriteria(RequestUtils.getSubject(request), c);
request.setAttribute(Constants.PENDING_USERS_ATTR, pendingUsers);
/*
* available users are all users in the system that are /not/ associated with the role and are not pending
*/
log.trace("getting available users for role [" + roleId + "]");
PageList<Subject> availableUsers = subjectManager.findAvailableSubjectsForRole(
RequestUtils.getSubject(request), roleId, pendingUserIds, pca);
request.setAttribute(Constants.AVAIL_USERS_ATTR, availableUsers);
return null;
}