Пример #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);
  }
Пример #2
0
  protected String buildEntryURL(BlogsEntry entry, ThemeDisplay themeDisplay)
      throws PortalException {

    StringBundler sb = new StringBundler(4);

    sb.append(PortalUtil.getLayoutFullURL(themeDisplay));
    sb.append(Portal.FRIENDLY_URL_SEPARATOR);
    sb.append("blogs/");
    sb.append(entry.getUrlTitle());

    return sb.toString();
  }
  protected void updateEntryAssets() throws Exception {
    try (LoggingTimer loggingTimer = new LoggingTimer()) {
      List<BlogsEntry> entries = _blogsEntryLocalService.getNoAssetEntries();

      if (_log.isDebugEnabled()) {
        _log.debug("Processing " + entries.size() + " entries with no asset");
      }

      for (BlogsEntry entry : entries) {
        try {
          _blogsEntryLocalService.updateAsset(entry.getUserId(), entry, null, null, null, null);
        } catch (Exception e) {
          if (_log.isWarnEnabled()) {
            _log.warn(
                "Unable to update asset for entry " + entry.getEntryId() + ": " + e.getMessage());
          }
        }
      }

      if (_log.isDebugEnabled()) {
        _log.debug("Assets verified for entries");
      }
    }
  }