コード例 #1
0
  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;
  }
コード例 #2
0
  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;
  }
コード例 #3
0
  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;
  }