package q02b.procesos.action;



import java.util.HashMap;



import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;



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.infraestructura.traza.Q70TraceLevel;

import es.ejie.frmk.infraestructura.traza.Q70Traza;

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

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





public class Q02bActionInicializarMapaProcesos extends Q70ActionPasoOP {

	private static Q70Traza tr = Q70Traza.getSingleton();

	private static final String COMPONENTE = "ACTION PASOOP";



	protected void processOP(Q70ContextoEJIE contexto, ActionErrors errores,ActionMapping mapping,ActionForm form,

			HttpServletRequest request,HttpServletResponse response) throws Exception {		

		try{

			if (tr.isTraceActive()){

				tr.trace(COMPONENTE, Q70TraceLevel.INFO, this.getClass().getName() + ":processOP: entrando");

			}

			contexto.set("proceso", new HashMap());

			contexto.set("insertado", "false");

		}catch(Exception ex){

            java.io.StringWriter sw = new java.io.StringWriter();

            java.io.PrintWriter pw = new java.io.PrintWriter(sw);

            ex.printStackTrace(pw);

            if (tr.isTraceActive()){

				tr.trace(COMPONENTE, Q70TraceLevel.ERROR, this.getClass().getName() + ":processOP " + sw.getBuffer ().toString());

			}

            throw ex;

		 }finally{

			 if (tr.isTraceActive()){

					tr.trace(COMPONENTE, Q70TraceLevel.INFO, this.getClass().getName() + ":processOP: saliendo");

			 }

		 }	

	}

	

	protected ActionForward processForward(Q70ContextoEJIE contexto, ActionErrors errores, ActionMapping mapping,

			ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {

		

		try{

			if (tr.isTraceActive()){

				tr.trace(COMPONENTE, Q70TraceLevel.INFO, this.getClass().getName() + ":processForward: entrando");

			}							

			return mapping.findForward("ok");

		}catch(Exception ex){

            java.io.StringWriter sw = new java.io.StringWriter();

            java.io.PrintWriter pw = new java.io.PrintWriter(sw);

            ex.printStackTrace(pw);

            if (tr.isTraceActive()){

				tr.trace(COMPONENTE, Q70TraceLevel.ERROR, this.getClass().getName() + ":processForward " + sw.getBuffer ().toString());

			}

            throw ex;

		 }finally{

			 if (tr.isTraceActive()){

					tr.trace(COMPONENTE, Q70TraceLevel.INFO, this.getClass().getName() + ":processForward: saliendo");

			 }

		 }

	}



}