001 package hirondelle.web4jtools.codegenerator.restart; 002 003 import hirondelle.web4j.action.ActionImpl; 004 import hirondelle.web4j.request.RequestParser; 005 import hirondelle.web4j.action.ResponsePage; 006 import hirondelle.web4j.model.AppException; 007 import hirondelle.web4jtools.codegenerator.feature.FeatureAction; 008 import hirondelle.web4jtools.codegenerator.field.FieldAction; 009 010 /** 011 * Start a new feature. 012 * 013 * <P>Removes any existing items related to the feature from the session, 014 * and then redirects to the <tt>Feature</tt> page. 015 */ 016 public final class StartFreshAction extends ActionImpl { 017 018 public StartFreshAction(RequestParser aRequestParser){ 019 super(REDIRECT, aRequestParser); 020 } 021 022 @Override public ResponsePage execute() throws AppException { 023 removeItemsFromSession(); 024 return getResponsePage(); 025 } 026 027 // PRIVATE // 028 private static final ResponsePage REDIRECT = new ResponsePage("../feature/FeatureAction.do?Operation=Show"); 029 030 private void removeItemsFromSession() { 031 removeFromSession(FeatureAction.FEATURE_KEY); 032 removeFromSession(FieldAction.FIELDS_KEY); 033 } 034 }