private boolean isInternalPageThatDoesntExist(String linkPath) { String expandedPath = WikiWordReference.expandPrefix(page, linkPath); WikiPagePath path = PathParser.parse(expandedPath); if (path == null) { return true; } WikiPage start = path.isRelativePath() ? page.getParent() : page; // TODO -AcD- a better way? return !start.getPageCrawler().pageExists(path); }
protected WikiPage createInternalSymbolicPage( String linkPath, String linkName, WikiPage parent) { WikiPagePath path = PathParser.parse(linkPath); if (path == null) { return null; } WikiPage start = (path.isRelativePath()) ? parent.getParent() : parent; // TODO -AcD- a better way? WikiPage wikiPage = start.getPageCrawler().getPage(path); if (wikiPage != null) wikiPage = new SymbolicPage(linkName, wikiPage, parent); return wikiPage; }
private String makePathForSymbolicLink(String linkPath) { WikiPagePath wikiPagePath = PathParser.parse(linkPath); if (wikiPagePath != null) { WikiPage parent = wikiPagePath.isRelativePath() ? page.getParent() : page; PageCrawler crawler = parent.getPageCrawler(); WikiPage target = crawler.getPage(wikiPagePath); WikiPagePath fullPath; if (target != null) { fullPath = target.getPageCrawler().getFullPath(); fullPath.makeAbsolute(); } else fullPath = new WikiPagePath(); return fullPath.toString(); } return null; }
public Response makeResponse(FitNesseContext context, Request request) throws Exception { if (!getAndValidateRefactoredPage(context, request)) { return new NotFoundResponder().makeResponse(context, request); } if (!getAndValidateNewParentPage(context, request)) { return makeErrorMessageResponder(newParentPath.toString() + " does not exist.") .makeResponse(context, request); } if (!getAndValidateRefactoringParameters(request)) { return makeErrorMessageResponder("").makeResponse(context, request); } if (targetPageExists()) { return makeErrorMessageResponder(makeLink(getNewPageName()) + " already exists") .makeResponse(context, request); } if (request.hasInput("refactorReferences")) { getReferenceRenamer(context).renameReferences(); } execute(); SimpleResponse response = new SimpleResponse(); response.redirect(createRedirectionUrl(newParentPage, getNewPageName())); return response; }
private String makePathForSymbolicLink(String linkPath) throws Exception { WikiPagePath wikiPagePath = PathParser.parse(linkPath); if (wikiPagePath != null) { WikiPage parent = wikiPagePath.isRelativePath() ? page.getParent() : page; // TODO // -AcD- // a // better // way? PageCrawler crawler = parent.getPageCrawler(); WikiPage target = crawler.getPage(parent, wikiPagePath); WikiPagePath fullPath; if (target != null) { fullPath = crawler.getFullPath(target); fullPath.makeAbsolute(); } else fullPath = new WikiPagePath(); return fullPath.toString(); } return null; }
public PageTitle(WikiPagePath pagePath) { pagePath = pagePath.clone(); List<String> names = pagePath.getNames(); link = PathParser.render(pagePath); if (names.size() > 0) { title = names.get(names.size() - 1); pagePath.removeNameFromEnd(); while (pagePath.getNames().size() > 0) { names = pagePath.getNames(); BreadCrumb crumb = new BreadCrumb(names.get(names.size() - 1), PathParser.render(pagePath)); breadCrumbs.add(crumb); pagePath.removeNameFromEnd(); } Collections.reverse(breadCrumbs); } }