/*
 The caLAB Software License, Version 0.5

 Copyright 2006 SAIC. This software was developed in conjunction with the National 
 Cancer Institute, and so to the extent government employees are co-authors, any 
 rights in such works shall be subject to Title 17 of the United States Code, 
 section 105.

 */
package gov.nih.nci.calab.ui.core;

/**
 * This class calls the Struts ForwardAction to forward to a page, aslo 
 * extends AbstractBaseAction to inherit the user authentication features.
 *  
 * @author pansu
 */

/* CVS $Id: BaseForwardAction.java,v 1.1 2006-04-27 17:05:41 pansu Exp $ */

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.ForwardAction;

public class BaseForwardAction extends AbstractBaseAction {
	public ActionForward executeTask(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		ForwardAction forwardAction = new ForwardAction();
		return forwardAction.execute(mapping, form, request, response);
	}

	public boolean loginRequired() {
		return true;
	}
}

// public class BaseForwardAction extends ForwardAction {
// private static Logger logger = Logger.getLogger(BaseForwardAction.class);
//	
// public ActionForward execute(ActionMapping mapping, ActionForm form,
// HttpServletRequest request, HttpServletResponse response)
// throws Exception {
//		
// ActionForward forward = null;
// ActionMessages msgs = new ActionMessages();
//
// try {
// //TODO fill in the common operations */
// if (!loginRequired() ||
// loginRequired() && isUserLoggedIn(request)) {
// forward=super.execute(mapping, form, request, response);
// }
// else {
// logger.debug("an attempt to access the page without authentication.");
// ActionMessage error=new ActionMessage("error.login.required");
// msgs.add("error", error);
// saveMessages(request, msgs);
// forward = mapping.findForward("login");
// }
// } catch (Throwable t) {
// logger.error("Caught System Exception", t);
// ActionMessage error=new ActionMessage("error.system");
// msgs.add("error", error);
// saveMessages(request, msgs);
// forward = mapping.findForward("error");
// }
// return forward;
// }
//	
// /**
// *
// * @param request
// * @return whether the user is successfully logged in.
// */
// private boolean isUserLoggedIn(HttpServletRequest request) {
// boolean isLoggedIn=false;
// if (request.getSession().getAttribute("user")!=null) {
// isLoggedIn=true;
// }
// return isLoggedIn;
// }
//	
// public boolean loginRequired() {
// return true;
// }
// }

@@ -560,29 +560,29 @@
 v 1.
-1
+2
  2006-0
-4-27 17:05:41
+5-02 20:12:17
  pan
@@ -1273,1472 +1273,4 @@
 %7D%0A%7D%0A
-%0A// public class BaseForwardAction extends ForwardAction %7B%0A// private static Logger logger = Logger.getLogger(BaseForwardAction.class);%0A//%09%0A// public ActionForward execute(ActionMapping mapping, ActionForm form,%0A// HttpServletRequest request, HttpServletResponse response)%0A// throws Exception %7B%0A//%09%09%0A// ActionForward forward = null;%0A// ActionMessages msgs = new ActionMessages();%0A//%0A// try %7B%0A// //TODO fill in the common operations */%0A// if (!loginRequired() %7C%7C%0A// loginRequired() && isUserLoggedIn(request)) %7B%0A// forward=super.execute(mapping, form, request, response);%0A// %7D%0A// else %7B%0A// logger.debug(%22an attempt to access the page without authentication.%22);%0A// ActionMessage error=new ActionMessage(%22error.login.required%22);%0A// msgs.add(%22error%22, error);%0A// saveMessages(request, msgs);%0A// forward = mapping.findForward(%22login%22);%0A// %7D%0A// %7D catch (Throwable t) %7B%0A// logger.error(%22Caught System Exception%22, t);%0A// ActionMessage error=new ActionMessage(%22error.system%22);%0A// msgs.add(%22error%22, error);%0A// saveMessages(request, msgs);%0A// forward = mapping.findForward(%22error%22);%0A// %7D%0A// return forward;%0A// %7D%0A//%09%0A// /**%0A// *%0A// * @param request%0A// * @return whether the user is successfully logged in.%0A// */%0A// private boolean isUserLoggedIn(HttpServletRequest request) %7B%0A// boolean isLoggedIn=false;%0A// if (request.getSession().getAttribute(%22user%22)!=null) %7B%0A// isLoggedIn=true;%0A// %7D%0A// return isLoggedIn;%0A// %7D%0A//%09%0A// public boolean loginRequired() %7B%0A// return true;%0A// %7D%0A// %7D%0A

remove comments