private WikiPage createSymbolicPage(WikiPage page, String linkName) { WikiPageProperty symLinkProperty = page.getData().getProperties().getProperty(SymbolicPage.PROPERTY_NAME); if (symLinkProperty == null) return null; String linkPath = symLinkProperty.get(linkName); if (linkPath == null) return null; if (linkPath.startsWith("file:")) return createExternalSymbolicLink(linkPath, linkName, page); else return createInternalSymbolicPage(linkPath, linkName, page); }
private void makeSymbolicLinkSection() { WikiPageProperty symLinksProperty = pageData.getProperties().getProperty(SymbolicPage.PROPERTY_NAME); if (symLinksProperty == null) return; List<Symlink> symlinks = new ArrayList<Symlink>(); Set<String> symbolicLinkNames = symLinksProperty.keySet(); for (String name : symbolicLinkNames) { String link = symLinksProperty.get(name); String path = makePathForSymbolicLink(link); symlinks.add(new Symlink(name, Utils.escapeHTML(link), path)); } html.put("symlinks", symlinks); }
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); } }