Пример #1
0
  private void removeSymbolicLink(Request request, WikiPage page) {
    String linkToRemove = request.getInput("removal");

    PageData data = page.getData();
    WikiPageProperty properties = data.getProperties();
    WikiPageProperty symLinks = getSymLinkProperty(properties);
    symLinks.remove(linkToRemove);
    if (symLinks.keySet().isEmpty()) properties.remove(SymbolicPage.PROPERTY_NAME);
    page.commit(data);
    setRedirect(resource);
  }
Пример #2
0
  private void renameSymbolicLink(Request request, WikiPage page) throws Exception {
    String linkToRename = (String) request.getInput("rename"),
        newName = (String) request.getInput("newname");

    PageData data = page.getData();
    WikiPageProperty properties = data.getProperties();
    WikiPageProperty symLinks = getSymLinkProperty(properties);

    if (isValidWikiPageName(newName, symLinks)) {
      String currentPath = symLinks.get(linkToRename);
      symLinks.remove(linkToRename);
      symLinks.set(newName, currentPath);
      page.commit(data);
      setRedirect(resource);
    }
  }