Ejemplo n.º 1
0
  @Override
  public void addTrackback(
      BlogsEntry entry,
      ThemeDisplay themeDisplay,
      String excerpt,
      String url,
      String blogName,
      String title,
      Function<String, ServiceContext> serviceContextFunction)
      throws PortalException {

    long userId = UserLocalServiceUtil.getDefaultUserId(themeDisplay.getCompanyId());
    long groupId = entry.getGroupId();
    String className = BlogsEntry.class.getName();
    long classPK = entry.getEntryId();

    String body = buildBody(themeDisplay, excerpt, url);

    long commentId =
        CommentManagerUtil.addComment(
            userId, groupId, className, classPK, blogName, title, body, serviceContextFunction);

    String entryURL = buildEntryURL(entry, themeDisplay);

    LinkbackConsumerUtil.addNewTrackback(commentId, url, entryURL);
  }
  @Override
  public boolean hasViewPermission(PermissionChecker permissionChecker) throws PortalException {

    DiscussionPermission discussionPermission =
        CommentManagerUtil.getDiscussionPermission(permissionChecker);

    return discussionPermission.hasPermission(_workflowableComment.getCommentId(), ActionKeys.VIEW);
  }
  @Override
  public boolean hasEditPermission(PermissionChecker permissionChecker) throws PortalException {

    DiscussionPermission discussionPermission =
        CommentManagerUtil.getDiscussionPermission(permissionChecker);

    return discussionPermission.hasUpdatePermission(_workflowableComment.getCommentId());
  }
  @Override
  public boolean include(HttpServletRequest request, HttpServletResponse response, String template)
      throws Exception {

    Comment comment = CommentManagerUtil.fetchComment(_message.getMessageId());

    request.setAttribute(WebKeys.COMMENT, comment);

    return super.include(request, response, template);
  }