private AbstractPage getPage(String pageIdStr) { long pageId = Long.parseLong(pageIdStr); return pageManager.getAbstractPage(pageId); }
@Override public List<String> getCommentIds(String authenticationToken, String pageId) { AbstractPage page = pageManager.getAbstractPage(Long.parseLong(pageId)); List<String> commentIds = new Vector<String>(); if (null != page && permissionManager.hasPermission(AuthenticatedUserThreadLocal.getUser(), Permission.VIEW, page)) { commentIds.addAll( Collections2.transform( page.getComments(), new Function<Comment, String>() { @Override public String apply(Comment comment) { return comment.getIdAsString(); } } ) ); } return commentIds; }
AbstractPage commentPage = pageManager.getAbstractPage(Long.parseLong(pageIdStr)); if (null != commentPage)
public boolean startWatching(Long key) { AbstractPage page = pageManager.getAbstractPage(key); User user = AuthenticatedUserThreadLocal.get(); // Note that if page is null, that is, key is invalid, hasPermission is documented to say no permission, so // we 412 this which is desirable - it means we don't leak valid page ids if (!permissionManager.hasPermission(user, Permission.VIEW, page)) { // no permission to see page, don't let them watch it return false; } if (user != null && notificationManager.isUserWatchingPageOrSpace(user, null, page)) { //already watching the page. return true return true; } return watchHelper.startWatching(page, addPageNotification, getPageNotifications); }
private Option<Link> getPageWatchLink(User user, ActivityItem activityItem) { final Long pageId = activityItem.getId(); final AbstractPage page = pageManager.getAbstractPage(pageId); if (page == null) { return none(); } if (notificationManager.isUserWatchingPageOrSpace(user, page.getSpace(), page)) { return none(); } return some(new Link(buildWatchUrl(String.valueOf(pageId), PAGE_WATCH_ACTION), WATCH_LINK_REL, none(String.class))); }
page = pageManager.getAbstractPage(id);