* org.apache.struts.action.ActionForm,
* javax.servlet.http.HttpServletRequest,
* javax.servlet.http.HttpServletResponse)
*/
public ActionForward edit(ActionMapping mapping, ActionForm form,HttpServletRequest req, HttpServletResponse resp) {
UserSetInteractionEnterOrEditForm userSetInteractionEnterOrEditForm = (UserSetInteractionEnterOrEditForm) form;
UserSetCommandEntry userSetCommandEntry = (UserSetCommandEntry)commandEntryFromRequest(req);
Group group = userSetCommandEntry.getGroup();
checkAccessRights(req, group);
userSetInteractionEnterOrEditForm.setCommandEntryId(userSetCommandEntry.getId()); // not to be used when editing
userSetInteractionEnterOrEditForm.setSortLabel(userSetCommandEntry.getSortLabel());
userSetInteractionEnterOrEditForm.setUserSetId(userSetCommandEntry.getUserSet() != null ? userSetCommandEntry.getUserSet().getId() : -2);
userSetInteractionEnterOrEditForm.setCommandType(userSetCommandEntry.getUserSetCommandEntryType());
if(userSetCommandEntry.getNofUsers() != null){
userSetInteractionEnterOrEditForm.setNofUsers(userSetCommandEntry.getNofUsers().toString());
userSetInteractionEnterOrEditForm.setNofDrawings(userSetCommandEntry.getNofUsers().toString());
}
Set<UserSet> userSets = group.getUserSets();
if(userSetCommandEntry.getUserSetCommandEntryType().intValue() == 6){
userSetInteractionEnterOrEditForm.setAssignUserSetId(userSetCommandEntry.getUserSetOperand() != null ? userSetCommandEntry.getUserSetOperand().getId() : -2);
} else {
userSetInteractionEnterOrEditForm.setAssignUserSetId(userSets.iterator().next().getId());
}
if(userSetCommandEntry.getUserSetCommandEntryType().intValue() == 7){
userSetInteractionEnterOrEditForm.setReplaceWithUserSetId(userSetCommandEntry.getUserSetOperand() != null ? userSetCommandEntry.getUserSetOperand().getId() : -2);
} else {
userSetInteractionEnterOrEditForm.setReplaceWithUserSetId(userSets.iterator().next().getId());
}
if(userSetCommandEntry.getUserSetCommandEntryType().intValue() == 8){
userSetInteractionEnterOrEditForm.setRemoveUserSetId(userSetCommandEntry.getUserSetOperand() != null ? userSetCommandEntry.getUserSetOperand().getId() : -2);
} else {
userSetInteractionEnterOrEditForm.setRemoveUserSetId(userSets.iterator().next().getId());
}
if(userSetCommandEntry.getUserSetCommandEntryType().intValue() == 9){
userSetInteractionEnterOrEditForm.setKeepSharedUserSetId(userSetCommandEntry.getUserSetOperand() != null ? userSetCommandEntry.getUserSetOperand().getId() : -2);
} else {
userSetInteractionEnterOrEditForm.setKeepSharedUserSetId(userSets.iterator().next().getId());
}
if(userSetCommandEntry.getUserSetCommandEntryType().intValue() == 10){
userSetInteractionEnterOrEditForm.setDrawFromUserSetId(userSetCommandEntry.getUserSetOperand() != null ? userSetCommandEntry.getUserSetOperand().getId() : -2);
} else {
userSetInteractionEnterOrEditForm.setDrawFromUserSetId(userSets.iterator().next().getId());
}
Hibernate.initialize(userSets);
req.getSession().setAttribute("userSets", userSets);
req.getSession().setAttribute("enterOrEdit", "edit");