}
public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws Exception {
ActionForward actionForward = super.edit(mapping, form, request, response);
AccessRightsForm arf = (AccessRightsForm) form;
AccessRights accessRights = (AccessRights) ResourceStack.peekEditingStack(request.getSession());
if (actionForward.getName().equals("home")){
// super returned a home, so we must go home.
return actionForward;
}
List<AccessRight> accessRights2 = accessRights.getAccessRights();
PropertyList selectedAccessRights = new PropertyList();
for (AccessRight right : accessRights2) {
String permissionString = CoreUtil.getMessageResources(getSessionInfo(request).getHttpSession(),
right.getPermission().getBundle()).getMessage("permission." + right.getPermission().getId() + ".title").trim();
String resourceTypeString = CoreUtil.getMessageResources(getSessionInfo(request).getHttpSession(),
right.getResourceType().getBundle()).getMessage(
"resourceType." + right.getResourceType().getResourceTypeId() + ".title").trim();
String lableString = resourceTypeString + " " + permissionString;
selectedAccessRights.add(lableString);
}
AccessRightsMultiSelectDataSource accessRightsMultiSelectDataSource = new AccessRightsMultiSelectDataSource(accessRights
.getAccessRightsClass());
MultiSelectSelectionModel accessRightsModel = new MultiSelectSelectionModel(getSessionInfo(request),
accessRightsMultiSelectDataSource, selectedAccessRights);
arf.setAccessRightsModel(accessRightsModel);
arf.setSelectedAccessRights(selectedAccessRights);
return actionForward;
}