ActionForward forward = mapping.findForward("Bookmarks");
BookmarkFormEx form = (BookmarkFormEx)actionForm;
RollerRequest rreq = RollerRequest.getRollerRequest(request);
BookmarkManager bmgr = RollerFactory.getRoller().getBookmarkManager();
BookmarkData bd = null;
if (null != form.getId() && !form.getId().trim().equals(""))
{
bd = bmgr.getBookmark(form.getId());
}
else
{
bd = new BookmarkData();
FolderData fd = bmgr.getFolder(
request.getParameter(RollerRequest.FOLDERID_KEY));
bd.setFolder(fd);
}
RollerSession rses = RollerSession.getRollerSession(request);
if (bd.getFolder().getWebsite().hasUserPermissions(
rses.getAuthenticatedUser(), PermissionsData.AUTHOR))
{
form.copyTo(bd, request.getLocale());
bmgr.saveBookmark(bd);
RollerFactory.getRoller().flush();
CacheManager.invalidate(bd);
request.setAttribute(
RollerRequest.FOLDERID_KEY, bd.getFolder().getId());
}
else
{
ActionErrors errors = new ActionErrors();
errors.add(null, new ActionError("error.permissions.deniedSave"));