package org.atarix.ppl.portlets.flightBooking;
  
import java.util.Hashtable;

import org.apache.log4j.Logger;

import org.atarix.ppl.framework.action.jc.IJavaAction;

/**
 * This class checks whether the params introduced are correct or not
 */
public class CheckSearchParams implements IJavaAction
{
  // Define a static logger variable so that it references the
  // Logger instance named "CheckSearchParams".
  static Logger logger = Logger.getLogger(CheckSearchParams.class); 
  
  /**
   * 
   */
  public CheckSearchParams()
  {
    logger.debug("CheckSearchParams Class Constructor"); 
  }
  /**
   * This method checks if values are corrects
   * @param htParams
   * @param htResults
   * @return 
   */
  public boolean execute(Hashtable htParams, Hashtable htResults)
  {
    logger.debug("BEGIN CheckSearchParams Search");    
    String sFrom = (String)htParams.get("from") ;
    logger.debug("The value of 'from' is: " + sFrom) ;
    if (sFrom.equalsIgnoreCase("NO")) return false ;
    logger.debug("The value of 'to' is: " + (String)htParams.get("to")) ;
    logger.debug("The value of 'depDay' is: " + (String)htParams.get("depDay")) ;
    logger.debug("The value of 'depMonth' is: " + (String)htParams.get("depMonth")) ;
    logger.debug("The value of 'depYear' is: " + (String)htParams.get("depYear")) ;
    logger.debug("The value of 'retDay' is: " + (String)htParams.get("retDay")) ;
    logger.debug("The value of 'retMonth' is: " + (String)htParams.get("retMonth")) ;
    logger.debug("The value of 'retYear' is: " + (String)htParams.get("retYear")) ;
    logger.debug("The value of 'adults' is: " + (String)htParams.get("adults")) ;
    logger.debug("The value of 'children' is: " + (String)htParams.get("children")) ;
    logger.debug("The value of 'infants' is: " + (String)htParams.get("infants")) ;
    logger.debug("END CheckSearchParams Search");
    return true;
  }
  
}
