List of usage examples for com.liferay.portal.kernel.comment DiscussionPermission checkViewPermission
public void checkViewPermission(long companyId, long groupId, String className, long classPK) throws PortalException;
From source file:com.liferay.comment.internal.jsonws.CommentManagerJSONWS.java
License:Open Source License
public List<CommentJSONWS> getComments(long commentId, int start, int end) throws PortalException { DiscussionComment discussionComment = _commentManager.fetchDiscussionComment(getUserId(), commentId); DiscussionPermission discussionPermission = _commentManager.getDiscussionPermission(getPermissionChecker()); discussionPermission.checkViewPermission(getCompanyId(discussionComment.getGroupId()), discussionComment.getGroupId(), discussionComment.getClassName(), discussionComment.getClassPK()); return getComments(discussionComment, start, end); }
From source file:com.liferay.comment.internal.jsonws.CommentManagerJSONWS.java
License:Open Source License
public List<CommentJSONWS> getComments(long groupId, String className, long classPK, int start, int end) throws PortalException { DiscussionPermission discussionPermission = _commentManager.getDiscussionPermission(getPermissionChecker()); discussionPermission.checkViewPermission(getCompanyId(groupId), groupId, className, classPK); Discussion discussion = _commentManager.getDiscussion(getUserId(), groupId, className, classPK, createServiceContextFunction()); DiscussionComment rootDiscussionComment = discussion.getRootDiscussionComment(); return getComments(rootDiscussionComment, start, end); }
From source file:com.liferay.comment.internal.jsonws.CommentManagerJSONWS.java
License:Open Source License
public int getCommentsCount(long groupId, String className, long classPK) throws PortalException { DiscussionPermission discussionPermission = _commentManager.getDiscussionPermission(getPermissionChecker()); discussionPermission.checkViewPermission(getCompanyId(groupId), groupId, className, classPK); return _commentManager.getCommentsCount(className, classPK); }
From source file:com.liferay.screens.service.impl.ScreensCommentServiceImpl.java
License:Open Source License
@Override public JSONObject getComment(long commentId) throws PortalException { DiscussionPermission discussionPermission = commentManager.getDiscussionPermission(getPermissionChecker()); Comment comment = commentManager.fetchComment(commentId); AssetEntry assetEntry = assetEntryLocalService.getEntry(comment.getClassName(), comment.getClassPK()); Group group = groupLocalService.getGroup(assetEntry.getGroupId()); discussionPermission.checkViewPermission(group.getCompanyId(), assetEntry.getGroupId(), comment.getClassName(), comment.getClassPK()); return toJSONObject(comment, discussionPermission); }
From source file:com.liferay.screens.service.impl.ScreensCommentServiceImpl.java
License:Open Source License
@Override public JSONArray getComments(String className, long classPK, int start, int end) throws PortalException { DiscussionPermission discussionPermission = commentManager.getDiscussionPermission(getPermissionChecker()); AssetEntry assetEntry = assetEntryLocalService.getEntry(className, classPK); Group group = groupLocalService.getGroup(assetEntry.getGroupId()); discussionPermission.checkViewPermission(group.getCompanyId(), assetEntry.getGroupId(), className, classPK); Discussion discussion = commentManager.getDiscussion(getUserId(), assetEntry.getGroupId(), className, classPK, createServiceContextFunction()); DiscussionComment rootDiscussionComment = discussion.getRootDiscussionComment(); if (start == QueryUtil.ALL_POS) { start = 0;//ww w . j av a2s .c o m } DiscussionCommentIterator threadDiscussionCommentIterator = rootDiscussionComment .getThreadDiscussionCommentIterator(start); JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); if (end == QueryUtil.ALL_POS) { while (threadDiscussionCommentIterator.hasNext()) { JSONObject jsonObject = toJSONObject(threadDiscussionCommentIterator.next(), discussionPermission); jsonArray.put(jsonObject); } } else { int commentsCount = end - start; while (threadDiscussionCommentIterator.hasNext() && (commentsCount > 0)) { JSONObject jsonObject = toJSONObject(threadDiscussionCommentIterator.next(), discussionPermission); jsonArray.put(jsonObject); commentsCount--; } } return jsonArray; }
From source file:com.liferay.screens.service.impl.ScreensCommentServiceImpl.java
License:Open Source License
@Override public int getCommentsCount(String className, long classPK) throws PortalException { DiscussionPermission discussionPermission = commentManager.getDiscussionPermission(getPermissionChecker()); AssetEntry assetEntry = assetEntryLocalService.getEntry(className, classPK); Group group = groupLocalService.getGroup(assetEntry.getGroupId()); discussionPermission.checkViewPermission(group.getCompanyId(), assetEntry.getGroupId(), className, classPK); return commentManager.getCommentsCount(className, classPK); }