RollbackResponder.java :  » Testing » StoryTestIQ » fitnesse » responders » versions » Java Open Source

Java Open Source » Testing » StoryTestIQ 
StoryTestIQ » fitnesse » responders » versions » RollbackResponder.java
// Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
// Released under the terms of the GNU General Public License version 2 or later.
package fitnesse.responders.versions;

import fitnesse.*;
import fitnesse.responders.*;
import fitnesse.authentication.*;
import fitnesse.components.*;
import fitnesse.wiki.*;
import fitnesse.http.*;

public class RollbackResponder implements SecureResponder {
  public Response makeResponse(FitNesseContext context, Request request) throws Exception {
    SimpleResponse response = new SimpleResponse();

    String resource = request.getResource();
    String version = (String) request.getInput("version");

    WikiPagePath path = PathParser.parse(resource);
    WikiPage page = context.root.getPageCrawler().getPage(context.root, path);
    if (page == null)
      return new NotFoundResponder().makeResponse(context, request);
    PageData data = page.getDataVersion(version);

    page.commit(data);

    RecentChanges.updateRecentChanges(data);
    response.redirect(resource);

    return response;
  }

  public SecureOperation getSecureOperation() {
    return new SecureWriteOperation();
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.