package q02b.contactos.router;



import org.apache.struts.action.ActionErrors;

import org.apache.struts.action.ActionForward;

import org.apache.struts.action.ActionMapping;



import es.ejie.frmk.presentacion.operacion.Q70DefaultRouterClass;

import es.ejie.frmk.presentacion.sesiondatos.Q70ContextoEJIE;



public class Q02bRouterAfterInsertContactos extends Q70DefaultRouterClass {



	final static String VARIABLE_ACCION= "accion";

	final static String VARIABLE_INICIO= "inicio";

	final static String VARIABLE_GUARDAR= "KEY_GUARDAR";

	final static String VARIABLE_REPETIR= "KEY_GUARDAR_REPETIR";

	final static String VARIABLE_FILTRO= "FILTRO";

	

	final static String MAPPING_ERROR = "error";

	final static String MAPPING_PORTADA="irPortada";

	final static String MAPPING_LISTADO="irListado";

	final static String MAPPING_FILTRO="irFiltro";

	final static String MAPPING_ALTA="irAlta";

	

	/**

	* @see es.ejie.frmk.presentacion.operacion.paso.ActionPasoOP#processForward(es.ejie.frmk.presentacion.sesiondatos.ContextoEJIE, org.apache.struts.action.ActionErrors, org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

	*/  

	public  ActionForward processForward(Q70ContextoEJIE contexto,ActionErrors errores,ActionMapping mapping) throws Exception 

	{    

			ActionForward salida = new ActionForward();			

			String accion = (String)contexto.get(VARIABLE_ACCION);

			String inicio = (String)contexto.get(VARIABLE_INICIO);

			if(accion.equals(VARIABLE_REPETIR)){

				salida = mapping.findForward(MAPPING_ALTA);

			}

			else if(accion.equals(VARIABLE_GUARDAR)){

				if (inicio.equals(VARIABLE_FILTRO)){

					salida = mapping.findForward(MAPPING_FILTRO);

				}

				else {

				salida = mapping.findForward(MAPPING_LISTADO);

			}

			}

			return salida;

	}

	

	

}

