// Decompiled by DJ v3.2.2.67 Copyright 2002 Atanas Neshkov  Date: 04/11/2003 19:00:07
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   Q70GestorDeNavegacionAnomalaAction.java

package es.ejie.frmk.presentacion.anomala;

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

import org.apache.struts.action.Action;
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.presentacion.base.Q70WorkflowUtils;

/**
 * <code>Action</code> que genera un <code>ActionError</code>. El mensaje del
 * <code>ActionError</code> es recuperado del fichero de Properties
 * correspondiente. La <code>Q70Mensaje Key</code> es la que se le pasa como
 * parameter en el fichero de struts-config en el action de tipo
 * <code>Q70GestorDeNavegacionAnomalaAction</code>
 * 
 * @version 1.0
 * Fecha: 16-nov-03
 */
public class Q70GestorDeNavegacionAnomalaAction extends Action
{	 

	/**
	 * Método que genera un <code>ActionError</code> si se ha producido una
	 * navegación anómala.
	 * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
    {
        try {
			ActionErrors errors = new ActionErrors();
			if(null != Q70WorkflowUtils.getNextStateViolationAction(request))
			{
				String errorViolacion = null;
				errorViolacion = mapping.getParameter();
				if (errorViolacion!=null && errorViolacion.length() > 0)
				{
					errors.add("violation", new ActionError(errorViolacion));
			        saveErrors(request, errors);
				}
			}
			return mapping.findForward("success");
		} catch (RuntimeException e) {
			throw new Q70NavegacionAnomalaException(this.getClass().toString(), "execute", "Error al generar el ActionError correspondiente para la navegación anómala detectada.", e);
		}
    }
}