/*

 * Fecha: 15-abr-04

 */

package q02b.action;

  



import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;



import org.apache.struts.action.ActionError;

import org.apache.struts.action.ActionErrors;

import org.apache.struts.action.ActionForm;

import org.apache.struts.action.ActionForward;

import org.apache.struts.action.ActionMapping;



import es.ejie.frmk.listeners.base.Q70ListenerUtils;

import es.ejie.frmk.presentacion.operacion.paso.Q70ActionPasoOP;

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



/**

 * @version 1.0

 * Fecha: 15-abr-04

 */  

public class Q02bActionCambiarIdioma extends Q70ActionPasoOP {



	/**

	 * @see es.ejie.frmk.presentacion.operacion.paso.ActionPasoOP#processOP(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)

	 */

	protected void processOP(

		Q70ContextoEJIE contexto,

		ActionErrors errores,

		ActionMapping mapping,

		ActionForm form,

		HttpServletRequest request,

		HttpServletResponse response)

		throws Exception {

		

		String idioma = request.getParameter("idioma");

		String idiomaGlobal = Q70ListenerUtils.getAppGroupLanguage(request,null);

		if(idioma!= null){

			contexto.set("idioma",idioma);
        }
		if (null == idiomaGlobal){

			//Actualizar el valor del idioma compartido del contexto de aplicacion y el de la sesion

			Q70ListenerUtils.updateLanguage(request,idioma);			

		}else{

			errores.add("idioma",new ActionError("error.idioma"));

		}

	}

	/**

	 * @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)

	 */

	protected ActionForward processForward(

		Q70ContextoEJIE contexto,

		ActionErrors errores,

		ActionMapping mapping,

		ActionForm form,

		HttpServletRequest request,

		HttpServletResponse response)

		throws Exception {

		

		return mapping.findForward("ok");

	}



}

