/**
 * Copyright (c) 2003-2005 System Integrator Corporation.
 *                 All Rights Reserved.
 */
package jp.co.sint.beans.mallmgr;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import jp.co.sint.basic.SIBasic;
import jp.co.sint.basic.SICust;
import jp.co.sint.basic.SIEstimate;
import jp.co.sint.basic.SILogin;
import jp.co.sint.config.SIConfig;
import jp.co.sint.database.SIDBAccessException;
import jp.co.sint.database.SIDBUtil;
import jp.co.sint.database.SITableCondition;
import jp.co.sint.database.SITableConditionManager;
import jp.co.sint.tools.SICheckDataConf;
import jp.co.sint.tools.SICheckValid;
import jp.co.sint.tools.SICustomError;
import jp.co.sint.tools.SICustomErrors;
import jp.co.sint.tools.SIURLMap;
import jp.co.sint.tools.SIURLParameter;
import jp.co.sint.tools.SIUtil;

import org.apache.log4j.Category;

/**
 * @version $Id : UICmdtyParent.java,v 1.0 Exp $
 * @author : Tsuyoshi Yagi <br>
 * Description :顧客検索に対するBean
 * <p>
 * History
 * </p>
 * <p>
 * Author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reason
 * </p>
 * ============&nbsp;&nbsp;&nbsp;==========&nbsp;&nbsp;=========================== <br>
 * Tsuyoshi Yagi 2005/08/19 Original
 */
public class UICmdtyCust extends SIBasic {
  // ログ用のインスタンスの生成
  private static Category log = Category.getInstance(SIConfig.SILOG4J_WEBSHOP_CATEGORY_NAME);
  
  // 顧客コードFrom
  private String custCodeFrom = "";
  
  // 顧客コードTo
  private String custCodeTo = "";
  
  // メールアドレス
  private String eMail = "";
  
  // 電話番号
  private String tel = "";
  
  // 顧客名
  private String custName = "";
  
  // 顧客名カナ
  private String custPronName = "";
  
  // サロン名
  private String companyName = "";
  
  // 会社名
  private String corporationName = "";
  
  private String condtionSQL = "";
  
  private boolean closeWindow = false;
  
  private String counter = "";
  
  private boolean searchFlg = true;
  
  public UICmdtyCust() {}
  
  /**
   * @return companyName を戻します。
   */
  public String getCompanyName() {
    return companyName;
  }
  
  /**
   * @param companyName companyName を設定。
   */
  public void setCompanyName(String companyName) {
    this.companyName = companyName;
  }
  
  /**
   * @return custCodeFrom を戻します。
   */
  public String getCustCodeFrom() {
    return custCodeFrom;
  }
  
  /**
   * @param custCodeFrom custCodeFrom を設定。
   */
  public void setCustCodeFrom(String custCodeFrom) {
    this.custCodeFrom = custCodeFrom;
  }
  
  /**
   * @return custCodeTo を戻します。
   */
  public String getCustCodeTo() {
    return custCodeTo;
  }
  
  /**
   * @param custCodeTo custCodeTo を設定。
   */
  public void setCustCodeTo(String custCodeTo) {
    this.custCodeTo = custCodeTo;
  }
  
  /**
   * @return custName を戻します。
   */
  public String getCustName() {
    return custName;
  }
  
  /**
   * @param custName custName を設定。
   */
  public void setCustName(String custName) {
    this.custName = custName;
  }
  
  /**
   * @return custPronName を戻します。
   */
  public String getCustPronName() {
    return custPronName;
  }
  
  /**
   * @param custPronName custPronName を設定。
   */
  public void setCustPronName(String custPronName) {
    this.custPronName = custPronName;
  }
  
  /**
   * @return eMail を戻します。
   */
  public String getEMail() {
    return eMail;
  }
  
  /**
   * @param mail eMail を設定。
   */
  public void setEMail(String mail) {
    eMail = mail;
  }
  
  /**
   * @return tel を戻します。
   */
  public String getTel() {
    return tel;
  }
  
  /**
   * @param tel tel を設定。
   */
  public void setTel(String tel) {
    this.tel = tel;
  }
  
  /**
   * @return closeWindow を戻します。
   */
  public boolean getCloseWindow() {
    return closeWindow;
  }
  
  /**
   * @param closeWindow closeWindow を設定。
   */
  public void setCloseWindow(boolean closeWindow) {
    this.closeWindow = closeWindow;
  }
  
  /**
   * @return condtionSQL を戻します。
   */
  public String getCondtionSQL() {
    return condtionSQL;
  }
  
  /**
   * @param condtionSQL condtionSQL を設定。
   */
  public void setCondtionSQL(String condtionSQL) {
    this.condtionSQL = condtionSQL;
  }
  
  /*
   * getter of counter.
   */
  public String getCounter() {
    return counter;
  }
  
  /*
   * setter of counter
   */
  public void setCounter(String counter) {
    this.counter = counter;
  }
  
  public String getCorporationName() {
    return corporationName;
  }
  
  public void setCorporationName(String corporationName) {
    if (SIUtil.isNull(corporationName)) corporationName = "";
    this.corporationName = corporationName;
  }
  
  /**
   * <b>init </b> 入力値で初期化
   * 
   * @param lRequest
   * @param lUrlParam
   */
  public void init(HttpServletRequest lRequest, SIURLParameter lUrlParam) {
    super.init(lRequest, lUrlParam);
    this.setEncode(SIConfig.SIENCODE_SHIFT_JIS);
    this.setCustCodeFrom((String) lUrlParam.getParam("custCodeFrom"));
    this.setCustCodeTo((String) lUrlParam.getParam("custCodeTo"));
    this.setEMail((String) lUrlParam.getParam("eMail"));
    this.setTel((String) lUrlParam.getParam("tel"));
    this.setCustName((String) lUrlParam.getParam("custName"));
    this.setCustPronName((String) lUrlParam.getParam("custPronName"));
    this.setCompanyName((String) lUrlParam.getParam("companyName"));
    this.setCorporationName((String) lUrlParam.getParam("corporationName"));
    counter = (String) lUrlParam.getParam("counter");
  }
  
  /**
   * getCollection
   * 
   * @param Connection
   * @return Collection
   * @throws SIDBAccessException
   */
  public Collection getCollection(Connection lConnection) throws SIDBAccessException {
    Statement lStatement = null;
    ResultSet lResultSet = null;
    SICust currCustomer = new SICust();
    StringBuffer lSqlBuf = new StringBuffer();
    StringBuffer lCountBuf = new StringBuffer();
    Collection lResultColl = new ArrayList();
    
    if (!searchFlg) return lResultColl;
    
    // 出力項目
    lSqlBuf.append(" SELECT custcode,companyname,corporationname,custname,custpronname,email,tel,storetel,receivableflg ");
    lSqlBuf.append(" FROM custtbl ");
    lSqlBuf.append(" WHERE 1=1 ");
    
    lCountBuf.append(" SELECT count(custcode) FROM custtbl where 1=1 ");
    
    // 結合の条件
    lSqlBuf.append(this.getCondtionSQL());
    lCountBuf.append(this.getCondtionSQL());
    
    // 出力順
    lSqlBuf.append(" ORDER BY custcode DESC ");
    
    // 実行
    try {
      String rowCnt = SIDBUtil.getFirstData(lConnection, lCountBuf.toString());
      if (rowCnt.equals("") || rowCnt == null) {
        rowCnt = "0";
      }
      int lRecordCount = Integer.parseInt(rowCnt);// レコード数の取得
      
      int lPageSize = this.getPageSize();// ページサイズ
      int lPageNumber = this.getPageNumer();// ページ番号
      
      int lMaxPage = lRecordCount / lPageSize;
      if (lRecordCount % lPageSize > 0) {
        lMaxPage++;
      }
      if (lPageNumber > lMaxPage) lPageNumber = lMaxPage;
      
      // 開始レコードの番号の設定
      int lFromInx = (lPageNumber - 1) * lPageSize;
      // 終止のレコード番号の設定
      int lToInx = lFromInx + lPageSize - 1;
      if (lFromInx < 0) lFromInx = 0;
      if (lToInx < 0) lToInx = 0;
      
      log.debug("getCollection:lFromInx=" + lFromInx + ",lToInx=" + lToInx + ",lRecordCount=" + lRecordCount);
      
      log.debug("getCollection:lCmdtySqlBuf=" + lSqlBuf.toString());
      lStatement = lConnection.createStatement();
      lSqlBuf.append(" LIMIT ").append(lPageSize);
      if(lFromInx>0) lSqlBuf.append(" OFFSET ").append(lFromInx);
      lResultSet = lStatement.executeQuery(lSqlBuf.toString());
      
      for (int jj = 0; jj < lFromInx; jj++)
        lResultColl.add(null);
      
      int lIndex = 0;
      
      // レコードのセットの作成
      while (lResultSet.next() && lIndex < lPageSize) {
        currCustomer = new SICust();
        currCustomer.setEncode(SIConfig.SIENCODE_NONE);
        currCustomer.setCustCode(lResultSet.getString("custcode"));
        currCustomer.setCompanyName(lResultSet.getString("companyname"));
        currCustomer.setCorporationName(lResultSet.getString("corporationname"));
        currCustomer.setCustName(lResultSet.getString("custname"));
        currCustomer.setCustPronName(lResultSet.getString("custpronname"));
        currCustomer.setEmail(lResultSet.getString("email"));
        currCustomer.setTel(lResultSet.getString("tel"));
        currCustomer.setStoreTel(lResultSet.getString("storetel"));
        currCustomer.setReceivableFlg(lResultSet.getString("receivableflg"));
        lResultColl.add(currCustomer);
        lIndex++;
      }
      for (int jj = lFromInx + lPageSize; jj < lRecordCount; jj++)
        lResultColl.add(null);
    } catch (Exception ex) {
      log.debug("exception sql = " + lSqlBuf.toString());
      throw new SIDBAccessException(ex);
    } finally {
      SIDBUtil.close(lResultSet, lStatement);
    }
    return lResultColl;
  }
  
  /**
   * getCondtionSQL 検索条件に使用します。
   * 
   * @param
   * @return String
   * @throws
   */
  public String getCondtionSQLtxt() {
    SITableConditionManager lConditionMan = new SITableConditionManager();
    
    SITableCondition DD = new SITableCondition("", "CustCode", this.custCodeFrom, SIConfig.SICONDITION_TYPE_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    DD.setBlankEnable(false);
    lConditionMan.add(DD);
    //DD = new SITableCondition("", "CustCode", this.custCodeTo, SIConfig.SICONDITION_TYPE_LESS_EQUAL, SIConfig.SICONDITION_TYPE_AND);
    //lConditionMan.add(DD);
    
    DD = new SITableCondition("", "email", this.eMail, SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("AND (tel LIKE '%" + SIDBUtil.SQL2Like(this.tel) + "%' OR storetel LIKE '%" + SIDBUtil.SQL2Like(this.tel) + "%') ");
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "custName", this.custName, SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "custPronName", this.custPronName, SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "companyName", this.companyName, SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    DD = new SITableCondition("", "corporationName", this.corporationName, SIConfig.SICONDITION_TYPE_LIKE, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    // 通常 ( DELETE 未満 )
    DD = new SITableCondition("", "delflg", new Integer(SIConfig.SIDEL_FLG_DELETE), SIConfig.SICONDITION_TYPE_LESS, SIConfig.SICONDITION_TYPE_AND);
    lConditionMan.add(DD);
    
    return lConditionMan.getCondtionSQL();
  }
  
  /**
   * <b>decide</b> 決定したブランド名、ブランドコードを商品明細のセッション情報に設定
   * 
   * @param lRequest
   * @param lConnection
   * @param regMaker
   * @return
   */
  public boolean decide(HttpServletRequest lRequest, String custCode, Connection conn, SILogin manLogin) throws SIDBAccessException {
    lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    SICustomErrors errors = new SICustomErrors();
    
    SIEstimate estimate = new SIEstimate();
    UICustPointListCond lcustPoint = new UICustPointListCond();
    
    HttpSession session = lRequest.getSession(true);// セッションの取得
    if (counter.equals(SIURLMap.getHttpsUrl(lRequest, "webshop.jsp.manager.estimate.newestimate"))) {
      UIRegNewEstimate estimateFull = (UIRegNewEstimate) session.getAttribute(SIConfig.SISESSION_MAN_ESTIMATE_NEW_ESTIMATE);
      if (estimateFull == null) {
        estimateFull = new UIRegNewEstimate();
      }
      estimate = estimateFull.getEstimate();
    } else if (counter.equals(SIURLMap.getHttpsUrl(lRequest, "webshop.jsp.manager.estimate.updateestimate"))) {
      UIRegUpdateEstimate estimateFull = (UIRegUpdateEstimate) session.getAttribute(SIConfig.SISESSION_MAN_UPDATE_ESTIMATE);
      if (estimateFull == null) {
        estimateFull = new UIRegUpdateEstimate();
      }
      estimate = estimateFull.getEstimate();
    } else if (counter.equals(SIURLMap.getHttpsUrl(lRequest, "webshop.jsp.manager.estimate.freeestimate"))) {
      UIRegNewEstimate estimateFull = (UIRegNewEstimate) session.getAttribute(SIConfig.SISESSION_MAN_ESTIMATE_FREEESTIMATE);
      if (estimateFull == null) {
        estimateFull = new UIRegNewEstimate();
      }
    } else if (counter.equals(SIURLMap.getHttpsUrl(lRequest, "webshop.jsp.manager.estimate.freeestimateupdate"))) {
      UIRegUpdateEstimate estimateFull = (UIRegUpdateEstimate) session.getAttribute(SIConfig.SISESSION_MAN_ESTIMATE_FREEESTIMATE_UPDATE);
      if (estimateFull == null) {
        estimateFull = new UIRegUpdateEstimate();
      }
      estimate = estimateFull.getEstimate();
    }
    
    String sql = "SELECT * FROM custtbl WHERE custcode=" + SIDBUtil.SQL2Str(custCode);
    Statement lStatement = null;
    ResultSet lResultSet = null;
    
    try {
      lStatement = conn.createStatement();
      lResultSet = lStatement.executeQuery(sql);
      while (lResultSet.next()) {
        estimate.setCustCode(custCode);
        estimate.setCustName(lResultSet.getString("custname"));
        estimate.setCustPronName(lResultSet.getString("custPronName"));
        estimate.setBusinessForm(lResultSet.getString("job"));
        estimate.setTel(lResultSet.getString("tel"));
        estimate.setStoreTel(lResultSet.getString("storetel"));
        estimate.setFax(lResultSet.getString("fax"));
        estimate.setEmail(lResultSet.getString("email"));
        estimate.setPostCode1(lResultSet.getString("postcode1"));
        estimate.setPostCode2(lResultSet.getString("postcode2"));
        estimate.setCompanyName(lResultSet.getString("corporationname"));
        estimate.setAddress1(lResultSet.getString("address1"));
        estimate.setAddress2(lResultSet.getString("address2"));
        estimate.setAddress3(lResultSet.getString("address3"));
        estimate.setEstimateAddrressee(lResultSet.getString("custname"));
        estimate.setMemberLevelCode(lResultSet.getString("memberLevelCode"));
      }
      estimate.setMaxPoint(lcustPoint.getCustPoint(conn, manLogin, custCode));
      
    } catch (Exception ex) {
      throw new SIDBAccessException(ex);
    } finally {
      SIDBUtil.close(lStatement, lResultSet);
    }
    
    if (counter.equals(SIURLMap.getHttpsUrl(lRequest, "webshop.jsp.manager.estimate.newestimate"))) {
      UIRegNewEstimate estimateFull = (UIRegNewEstimate) session.getAttribute(SIConfig.SISESSION_MAN_ESTIMATE_NEW_ESTIMATE);
      if (estimateFull == null) {
        estimateFull = new UIRegNewEstimate();
      }
      estimateFull.setEstimate(estimate);
      
      session.setAttribute(SIConfig.SISESSION_MAN_ESTIMATE_NEW_ESTIMATE, estimateFull);
    } else if (counter.equals(SIURLMap.getHttpsUrl(lRequest, "webshop.jsp.manager.estimate.updateestimate"))) {
      UIRegUpdateEstimate estimateFull = (UIRegUpdateEstimate) session.getAttribute(SIConfig.SISESSION_MAN_UPDATE_ESTIMATE);
      if (estimateFull == null) {
        estimateFull = new UIRegUpdateEstimate();
      }
      estimateFull.setEstimate(estimate);
      
      session.setAttribute(SIConfig.SISESSION_MAN_UPDATE_ESTIMATE, estimateFull);
    } else if (counter.equals(SIURLMap.getHttpsUrl(lRequest, "webshop.jsp.manager.estimate.freeestimate"))) {
      UIRegNewEstimate estimateFull = (UIRegNewEstimate) session.getAttribute(SIConfig.SISESSION_MAN_ESTIMATE_FREEESTIMATE);
      if (estimateFull == null) {
        estimateFull = new UIRegNewEstimate();
      }
      estimateFull.setEstimate(estimate);
      
      session.setAttribute(SIConfig.SISESSION_MAN_ESTIMATE_FREEESTIMATE, estimateFull);
    } else if (counter.equals(SIURLMap.getHttpsUrl(lRequest, "webshop.jsp.manager.estimate.freeestimateupdate"))) {
      UIRegUpdateEstimate estimateFull = (UIRegUpdateEstimate) session.getAttribute(SIConfig.SISESSION_MAN_ESTIMATE_FREEESTIMATE_UPDATE);
      if (estimateFull == null) {
        estimateFull = new UIRegUpdateEstimate();
      }
      estimate.setEstimataCode(estimateFull.getEstimate().getEstimataCode());
      estimateFull.setEstimate(estimate);
      
      session.setAttribute(SIConfig.SISESSION_MAN_ESTIMATE_FREEESTIMATE_UPDATE, estimateFull);
    }
    
    this.setCloseWindow(true);
    
    return errors.isEmpty();
  }
  
  /**
   * <b>decide2</b> 決定した顧客情報をセッションに記録
   * 
   * @param lRequest
   * @param lConnection
   * @param regMaker
   * @return
   */
  public boolean decide2(HttpServletRequest lRequest, String custCode, Connection conn, SILogin manLogin) throws SIDBAccessException {
    lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    SICustomErrors errors = new SICustomErrors();
    
    HttpSession session = lRequest.getSession(true);// セッションの取得
    UIRegOtherOrder otherOrder = (UIRegOtherOrder) session.getAttribute(SIConfig.SISESSION_MAN_OTHERORDER_EDIT_NAME);
    if (otherOrder == null) otherOrder = new UIRegOtherOrder();
    
    String sql = "SELECT * FROM custtbl WHERE custcode=" + SIDBUtil.SQL2Str(custCode);
    Statement lStatement = null;
    ResultSet lResultSet = null;
    try {
      lStatement = conn.createStatement();
      lResultSet = lStatement.executeQuery(sql);
      while (lResultSet.next()) {
        otherOrder.setCustCode(custCode);
        otherOrder.setCustName(lResultSet.getString("custname"));
        otherOrder.setCustPronName(lResultSet.getString("custPronName"));
        otherOrder.setBusinessForm(lResultSet.getString("job"));
        otherOrder.setTel1(lResultSet.getString("storetel"));
        otherOrder.setTel2(lResultSet.getString("tel"));
        otherOrder.setFax(lResultSet.getString("fax"));
        otherOrder.setEMail(lResultSet.getString("email"));
        otherOrder.setPostCode1(lResultSet.getString("postcode1"));
        otherOrder.setPostCode2(lResultSet.getString("postcode2"));
        otherOrder.setCompanyName(lResultSet.getString("corporationname"));
        otherOrder.setAddress1(lResultSet.getString("address1"));
        otherOrder.setAddress2(lResultSet.getString("address2"));
        otherOrder.setAddress3(lResultSet.getString("address3"));
        otherOrder.setOrderAddressee(lResultSet.getString("custname"));
      }
    } catch (Exception ex) {
      throw new SIDBAccessException(ex);
    } finally {
      SIDBUtil.close(lResultSet, lStatement);
    }
    
    session.setAttribute(SIConfig.SISESSION_MAN_OTHERORDER_EDIT_NAME, otherOrder);
    this.setCloseWindow(true);
    return errors.isEmpty();
  }
  
  /**
   * <b>validate</b> 検索条件をチェックして、不正なデータがあればエラーオブジェクトに入れる
   * 
   * @param lRequest
   * @param lConnection
   * @return true:不正なデータがある false:ない
   */
  public boolean validate(HttpServletRequest lRequest, Connection lConnection) {
    
    lRequest.removeAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY);
    SICustomErrors errors = new SICustomErrors();
    
    SICheckValid.checkValid(errors, "顧客コードFrom", this.getCustCodeFrom(), SICheckDataConf.SICHECK_DATA_DIGIT_TYPE);
    SICheckValid.checkValid(errors, "顧客コードFrom", this.getCustCodeFrom(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 10);
    SICheckValid.checkValid(errors, "顧客コードTo", this.getCustCodeTo(), SICheckDataConf.SICHECK_DATA_DIGIT_TYPE);
    SICheckValid.checkValid(errors, "顧客コードTo", this.getCustCodeTo(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 10);
    
    SICheckValid.checkValid(errors, "メールアドレス", this.getEMail(), SICheckDataConf.SICHECK_DATA_ASCII_TYPE);
    SICheckValid.checkValid(errors, "メールアドレス", this.getEMail(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 128);
    SICheckValid.checkValid(errors, "電話番号", this.getTel(), SICheckDataConf.SICHECK_DATA_DIGIT_TYPE);
    SICheckValid.checkValid(errors, "電話番号", this.getTel(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 16);
    SICheckValid.checkValid(errors, "顧客名", this.getCustName(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 100);
    SICheckValid.checkValid(errors, "顧客名カナ", this.getCustPronName(), SICheckDataConf.SICHECK_DATA_ZENKAKU_KANA_TYPE);
    SICheckValid.checkValid(errors, "顧客名カナ", this.getCustPronName(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 100);
    SICheckValid.checkValid(errors, "サロン名", this.getCompanyName(), SICheckDataConf.SICHECK_DATA_BYTE_LEN_WITHIN_TYPE, 100);
    try {
      if (SIUtil.isNotNull(this.getCustCodeFrom()) && SIUtil.isNotNull(this.getCustCodeTo())) {
        if (Integer.parseInt(this.getCustCodeFrom()) > Integer.parseInt(this.getCustCodeTo())) {
          errors.addError(new SICustomError("input.data.less", "顧客コードFrom", "顧客コードTo"));
        }
      }
    } catch (NumberFormatException e) {}
    
    if (!errors.isEmpty()) {
      lRequest.setAttribute(SIConfig.SIERROR_ATTRIBUTE_MESSAGE_KEY, errors);
      searchFlg = false;
    } else {
      this.setCondtionSQL(this.getCondtionSQLtxt());
    }
    return errors.isEmpty();
  }
}