this.contentManager = contentManager;
}
public ActionResult doExecute(HttpServletRequest req, RenderContext renderContext, Resource resource, JCRSessionWrapper session, Map<String, List<String>> parameters, URLResolver urlResolver) throws Exception {
// test if bookmark node is present
JCRSessionWrapper jcrSessionWrapper = JCRSessionFactory.getInstance().getCurrentUserSession(resource.getWorkspace(), resource.getLocale());
JCRNodeWrapper userBookmarks = null;
String userPath = renderContext.getUser().getLocalPath();
try {
userBookmarks = jcrSessionWrapper.getNode(userPath + "/" + bookmarkPath);
} catch (PathNotFoundException pnf) {
userBookmarks = contentManager.addNode(jcrSessionWrapper.getNode(userPath), bookmarkPath, "jnt:bookmarks", null, null,Locale.getDefault());
userBookmarks.saveSession();
}
if (userBookmarks != null && !contentManager.checkExistence(userBookmarks.getPath() + "/" + req.getParameter("jcr:title").replace(" ","-"), jcrSessionWrapper, Locale.getDefault())) {
JCRNodeWrapper bookmark = contentManager.addNode(userBookmarks, req.getParameter("jcr:title").replace(" ","-"), "jnt:bookmark", null, null, Locale.getDefault());
bookmark.setProperty("date", new GregorianCalendar());