コード例 #1
0
  @Override
  protected boolean hasPermission(
      PermissionChecker permissionChecker, long classPK, String actionId)
      throws PortalException, SystemException {

    return WikiPagePermission.contains(permissionChecker, classPK, actionId);
  }
コード例 #2
0
  public void movePageAttachmentToTrash(long nodeId, String title, String fileName)
      throws PortalException, SystemException {

    WikiPagePermission.check(getPermissionChecker(), nodeId, title, ActionKeys.DELETE);

    wikiPageLocalService.movePageAttachmentToTrash(nodeId, title, fileName);
  }
コード例 #3
0
  public WikiPage updatePage(
      long nodeId,
      String title,
      double version,
      String content,
      String summary,
      boolean minorEdit,
      String format,
      String parentTitle,
      String redirectTitle,
      ServiceContext serviceContext)
      throws PortalException, SystemException {

    WikiPagePermission.check(getPermissionChecker(), nodeId, title, ActionKeys.UPDATE);

    return wikiPageLocalService.updatePage(
        getUserId(),
        nodeId,
        title,
        version,
        content,
        summary,
        minorEdit,
        format,
        parentTitle,
        redirectTitle,
        serviceContext);
  }
コード例 #4
0
  public String getPagesRSS(
      long companyId,
      long nodeId,
      String title,
      int max,
      String type,
      double version,
      String displayStyle,
      String feedURL,
      String entryURL,
      Locale locale)
      throws PortalException, SystemException {

    WikiPagePermission.check(getPermissionChecker(), nodeId, title, ActionKeys.VIEW);

    String description = title;
    List<WikiPage> pages =
        wikiPageLocalService.getPages(nodeId, title, 0, max, new PageCreateDateComparator(true));
    boolean diff = true;

    return exportToRSS(
        companyId,
        title,
        description,
        type,
        version,
        displayStyle,
        feedURL,
        entryURL,
        pages,
        diff,
        locale);
  }
コード例 #5
0
  public WikiPage getPage(long nodeId, String title, double version)
      throws PortalException, SystemException {

    WikiPagePermission.check(getPermissionChecker(), nodeId, title, ActionKeys.VIEW);

    return wikiPageLocalService.getPage(nodeId, title, version);
  }
コード例 #6
0
  public List<WikiPage> getNodePages(long nodeId, int max) throws PortalException, SystemException {

    List<WikiPage> pages = new ArrayList<WikiPage>();

    int lastIntervalStart = 0;
    boolean listNotExhausted = true;

    while ((pages.size() < max) && listNotExhausted) {
      List<WikiPage> pageList =
          wikiPageLocalService.getPages(nodeId, true, lastIntervalStart, lastIntervalStart + max);

      lastIntervalStart += max;
      listNotExhausted = (pageList.size() == max);

      for (WikiPage page : pageList) {
        if (pages.size() >= max) {
          break;
        }

        if (WikiPagePermission.contains(getPermissionChecker(), page, ActionKeys.VIEW)) {

          pages.add(page);
        }
      }
    }

    return pages;
  }
コード例 #7
0
  public void emptyPageAttachments(long nodeId, String title)
      throws PortalException, SystemException {

    WikiPagePermission.check(getPermissionChecker(), nodeId, title, ActionKeys.DELETE);

    wikiPageLocalService.emptyPageAttachments(nodeId, title);
  }
コード例 #8
0
  public void deletePage(long nodeId, String title, double version)
      throws PortalException, SystemException {

    WikiPagePermission.check(getPermissionChecker(), nodeId, title, version, ActionKeys.DELETE);

    wikiPageLocalService.deletePage(nodeId, title, version);
  }
コード例 #9
0
  public WikiPage revertPage(
      long nodeId, String title, double version, ServiceContext serviceContext)
      throws PortalException, SystemException {

    WikiPagePermission.check(getPermissionChecker(), nodeId, title, ActionKeys.UPDATE);

    return wikiPageLocalService.revertPage(getUserId(), nodeId, title, version, serviceContext);
  }
コード例 #10
0
  @Override
  protected SocialActivityFeedEntry doInterpret(SocialActivity activity, ThemeDisplay themeDisplay)
      throws Exception {

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    if (!WikiPagePermission.contains(permissionChecker, activity.getClassPK(), ActionKeys.VIEW)) {

      return null;
    }

    String groupName = StringPool.BLANK;

    if (activity.getGroupId() != themeDisplay.getScopeGroupId()) {
      groupName = getGroupName(activity.getGroupId(), themeDisplay);
    }

    String creatorUserName = getUserName(activity.getUserId(), themeDisplay);

    int activityType = activity.getType();

    // Link

    WikiPageResource pageResource =
        WikiPageResourceLocalServiceUtil.getPageResource(activity.getClassPK());

    String link =
        themeDisplay.getPortalURL()
            + themeDisplay.getPathMain()
            + "/wiki/find_page?pageResourcePrimKey="
            + activity.getClassPK();

    // Title

    String titlePattern = null;

    if (activityType == WikiActivityKeys.ADD_PAGE) {
      titlePattern = "activity-wiki-add-page";
    } else if (activityType == WikiActivityKeys.UPDATE_PAGE) {
      titlePattern = "activity-wiki-update-page";
    }

    if (Validator.isNotNull(groupName)) {
      titlePattern += "-in";
    }

    String pageTitle = wrapLink(link, HtmlUtil.escape(cleanContent(pageResource.getTitle())));

    Object[] titleArguments = new Object[] {groupName, creatorUserName, pageTitle};

    String title = themeDisplay.translate(titlePattern, titleArguments);

    // Body

    String body = StringPool.BLANK;

    return new SocialActivityFeedEntry(link, title, body);
  }
コード例 #11
0
  public void movePage(long nodeId, String title, String newTitle, ServiceContext serviceContext)
      throws PortalException, SystemException {

    WikiPagePermission.check(getPermissionChecker(), nodeId, title, ActionKeys.DELETE);

    WikiNodePermission.check(getPermissionChecker(), nodeId, ActionKeys.ADD_PAGE);

    wikiPageLocalService.movePage(getUserId(), nodeId, title, newTitle, serviceContext);
  }
コード例 #12
0
  public void unsubscribePage(long nodeId, String title) throws PortalException, SystemException {

    WikiPagePermission.check(getPermissionChecker(), nodeId, title, ActionKeys.SUBSCRIBE);

    wikiPageLocalService.unsubscribePage(getUserId(), nodeId, title);
  }