// retrieves user and user set from IDs in form; throws exception if insufficient access rights
// also sets session attributes "users" and "userSets"
private void requestingUserAndUserSetPreparation(TimerEventEnterOrEditForm form, Group group, HttpServletRequest req) {
// user sets
UserSetManager userSetManager = new UserSetManager(locale, session);
UserSet[] userSetsOfTheGroup = userSetManager.getUserSets(group);
UserSet[] displayedUserSets = new UserSet[userSetsOfTheGroup.length + 1];
for (int i = 0; i < userSetsOfTheGroup.length; i++) {
displayedUserSets[i+1] = userSetsOfTheGroup[i];
}
UserSet notSelectedUserSet = new UserSet();
notSelectedUserSet.setId(-1L);
String noneSelectedString = getResources(req).getMessage(locale,"smssvc.noUserSetSelected");
notSelectedUserSet.setName("(" + noneSelectedString + ")");
displayedUserSets[0] = notSelectedUserSet;
req.getSession().setAttribute("userSets", displayedUserSets);
UserSet userSet = notSelectedUserSet; // none selected at the beginning
Long selectedUserSetId = form.getRequestingUserSetId();
if (selectedUserSetId != null && selectedUserSetId >= 1) {
// check if the selected user set is assigned to the selected group
UserSet selectedUserSet = userSetManager.getUserSet(selectedUserSetId);
if (group.getUserSets().contains(selectedUserSet)) {
userSet = selectedUserSet;
}
}
form.setRequestingUserSetId(userSet.getId());