public WikiPage addPage(
      long nodeId,
      String title,
      String content,
      String summary,
      boolean minorEdit,
      String format,
      String parentTitle,
      String redirectTitle,
      ServiceContext serviceContext)
      throws PortalException, SystemException {

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

    return wikiPageLocalService.addPage(
        getUserId(),
        nodeId,
        title,
        WikiPageConstants.VERSION_DEFAULT,
        content,
        summary,
        minorEdit,
        format,
        true,
        parentTitle,
        redirectTitle,
        serviceContext);
  }
  public void movePageAttachmentFromTrash(long nodeId, String title, String deletedFileName)
      throws PortalException, SystemException {

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

    wikiPageLocalService.movePageAttachmentFromTrash(nodeId, title, deletedFileName);
  }
  public String[] getTempPageAttachmentNames(long nodeId, String tempFolderName)
      throws PortalException, SystemException {

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

    return wikiPageLocalService.getTempPageAttachmentNames(getUserId(), tempFolderName);
  }
  public String getNodePagesRSS(
      long nodeId,
      int max,
      String type,
      double version,
      String displayStyle,
      String feedURL,
      String entryURL)
      throws PortalException, SystemException {

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

    WikiNode node = wikiNodePersistence.findByPrimaryKey(nodeId);

    long companyId = node.getCompanyId();
    String name = node.getName();
    String description = node.getDescription();
    List<WikiPage> pages = getNodePages(nodeId, max);
    boolean diff = false;
    Locale locale = null;

    return exportToRSS(
        companyId,
        name,
        description,
        type,
        version,
        displayStyle,
        feedURL,
        entryURL,
        pages,
        diff,
        locale);
  }
  public void deleteTempPageAttachment(long nodeId, String fileName, String tempFolderName)
      throws PortalException, SystemException {

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

    wikiPageLocalService.deleteTempPageAttachment(getUserId(), fileName, tempFolderName);
  }
  public void addPageAttachment(long nodeId, String title, String fileName, InputStream inputStream)
      throws PortalException, SystemException {

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

    wikiPageLocalService.addPageAttachment(getUserId(), nodeId, title, fileName, inputStream);
  }
  public void addPageAttachments(
      long nodeId, String title, List<ObjectValuePair<String, InputStream>> inputStream)
      throws PortalException, SystemException {

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

    wikiPageLocalService.addPageAttachments(getUserId(), nodeId, title, inputStream);
  }
  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);
  }
  public String addTempPageAttachment(
      long nodeId, String fileName, String tempFolderName, InputStream inputStream)
      throws PortalException, SystemException {

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

    return wikiPageLocalService.addTempPageAttachment(
        getUserId(), fileName, tempFolderName, inputStream);
  }
  public WikiPage addPage(
      long nodeId,
      String title,
      String content,
      String summary,
      boolean minorEdit,
      ServiceContext serviceContext)
      throws PortalException, SystemException {

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

    return wikiPageLocalService.addPage(
        getUserId(), nodeId, title, content, summary, minorEdit, serviceContext);
  }
Example #11
0
  public static List<WikiNode> getNodes(
      List<WikiNode> nodes, String[] hiddenNodes, PermissionChecker permissionChecker) {

    nodes = ListUtil.copy(nodes);

    Arrays.sort(hiddenNodes);

    Iterator<WikiNode> itr = nodes.iterator();

    while (itr.hasNext()) {
      WikiNode node = itr.next();

      if (!(Arrays.binarySearch(hiddenNodes, node.getName()) < 0)
          || !WikiNodePermission.contains(permissionChecker, node, ActionKeys.VIEW)) {

        itr.remove();
      }
    }

    return nodes;
  }
Example #12
0
  public static WikiNode getFirstNode(PortletRequest portletRequest)
      throws PortalException, SystemException {

    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
    long groupId = themeDisplay.getScopeGroupId();
    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    List<WikiNode> nodes = WikiNodeLocalServiceUtil.getNodes(groupId);

    PortletPreferences preferences = portletRequest.getPreferences();
    String[] visibleNodeNames = StringUtil.split(preferences.getValue("visibleNodes", null));
    nodes = orderNodes(nodes, visibleNodeNames);

    String[] hiddenNodes = StringUtil.split(preferences.getValue("hiddenNodes", StringPool.BLANK));
    Arrays.sort(hiddenNodes);

    for (WikiNode node : nodes) {
      if ((Arrays.binarySearch(hiddenNodes, node.getName()) < 0)
          && (WikiNodePermission.contains(permissionChecker, node, ActionKeys.VIEW))) {
        return node;
      }
    }
    return null;
  }