/**
 * 
 */
package org.ajax4jsf.portlet.lifecycle;

import javax.faces.context.FacesContext;
import javax.faces.event.PhaseId;
import javax.faces.lifecycle.Lifecycle;

/**
 * @author asmirnov
 *
 */
public class ProcessValidatorsPhase extends LifecyclePhase {

	private final LifecyclePhase nextPhase;

	/**
	 * @param lifecycle
	 */
	public ProcessValidatorsPhase(Lifecycle lifecycle) {
		super(lifecycle);
		nextPhase = new UpdateModelPhase(lifecycle);
	}

	/* (non-Javadoc)
	 * @see org.ajax4jsf.portlet.lifecycle.LifecyclePhase#executeNextPhase(javax.faces.context.FacesContext, javax.faces.event.PhaseListener[])
	 */
	protected void executeNextPhase(FacesContext context) {
		nextPhase.execute(context);

	}

	/* (non-Javadoc)
	 * @see org.ajax4jsf.portlet.lifecycle.LifecyclePhase#executePhase(javax.faces.context.FacesContext)
	 */
	public void executePhase(FacesContext context) {
		context.getViewRoot().processValidators(context);

	}

	/* (non-Javadoc)
	 * @see org.ajax4jsf.portlet.lifecycle.LifecyclePhase#getPhaseId()
	 */
	protected PhaseId getPhaseId() {
		return PhaseId.PROCESS_VALIDATIONS;
	}

}
