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

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

/**
 * @author asmirnov
 *
 */
public class ApplyValuesPhase extends LifecyclePhase {
	
	private final LifecyclePhase nextPhase;

	/**
	 * @param lifecycle
	 */
	public ApplyValuesPhase(Lifecycle lifecycle) {
		super(lifecycle);
		nextPhase = new ProcessValidatorsPhase(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().processDecodes(context);
	}

	/* (non-Javadoc)
	 * @see org.ajax4jsf.portlet.lifecycle.LifecyclePhase#getPhaseId()
	 */
	protected PhaseId getPhaseId() {
		// TODO Auto-generated method stub
		return PhaseId.APPLY_REQUEST_VALUES;
	}

}
