/*
 * Created on Jan 22, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package gov.va.med.esr.ui.ee.action;

//Java extension
import javax.servlet.http.*;

//Library classes
import org.apache.commons.lang.Validate;
import org.apache.struts.action.*;

//EDB Classes
import net.mlw.vlh.ValueList;
import gov.va.med.esr.ui.conversion.UIConversionServiceImpl;
import gov.va.med.esr.ui.conversion.UIConversionService;
import gov.va.med.fw.ui.struts.ValueListActionUtils;
import gov.va.med.esr.common.model.person.*;

/**
 * @author DNS   CHENB
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class ClinicalDeterAction extends EligibilityAction {
	public ClinicalDeterAction() {
		super();
	}
	   
	/**
	* Displays a search record
	* 
	* @param mapping An action mapping 
	* @param form A form bean
	* @param request A http request from an search.jsp page
	* @param response A http response to stream data to a next page
	* @return An action forward class encapsulating information about a next page
	* @throws java.lang.Exception Thrown if failed to process 
	*/
	public ActionForward display( ActionMapping mapping, 
	         						 ActionForm form,
	         						 HttpServletRequest request, 
	         						 HttpServletResponse response )
		throws Exception 
	{
		
		ClinicalDeterForm clinicalDeterForm = (form instanceof ClinicalDeterForm) ? (ClinicalDeterForm)form : null;
		Person person = getSelectedPerson( request );
		//Make it quick without config for now.
		
		UIConversionService uiConversionService = (UIConversionService)conversionService;
		uiConversionService.convert(person,clinicalDeterForm);
		
        // Get the value list information from the clinical deter form
        ValueList valueList = ValueListActionUtils.getValueList(clinicalDeterForm,
        		request, "cdDescriptorTableId", "cdDescriptorAdapter", clinicalDeterForm != null ? clinicalDeterForm.getDescriptors() : null);

        // Backup the ValueListInfo into session and store the resultant ValueList on the request
        ValueListActionUtils.setValueList(request, valueList, "vlhlist");
		  
		return mapping.findForward("success");
   }

	public void afterPropertiesSet() {
		// Check for required components here
	}
}
