/**
 * @(#)file    TermsAgreeBiz.java
 * @(#)author  이성민
 * @(#)version 1.0
 *
 */
package kr.co.udapsoft.ebid.supplier.portal.join.biz;



import java.sql.CallableStatement;
import java.sql.Connection;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;

import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

import kr.co.hsnc.common.base.WAFLogger;
import kr.co.hsnc.common.base.WAFMessages;
import kr.co.hsnc.common.logger.Logger;
import kr.co.hsnc.common.sql.Row;
import kr.co.hsnc.common.sql.RowSet;
import kr.co.hsnc.common.sql.RowSetImpl;
import kr.co.hsnc.common.sql.WAFSQLException;
import kr.co.hsnc.common.sql.persistent.Persistent;
import kr.co.hsnc.common.sql.persistent.PersistentImpl;
import kr.co.hsnc.common.sql.search.Search;
import kr.co.hsnc.common.sql.search.SearchImpl;
import kr.co.hsnc.common.sql.util.RowSetUtility;
import kr.co.hsnc.common.util.ValueObject;
import kr.co.udapsoft.common.sender.MessageSend;
import kr.co.udapsoft.common.sender.SmtpAuth;
import kr.co.udapsoft.ebid.buyer.common.file.FileManager;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;

import com.udapsoft.modular.web.ibsheet7.IBSheet7Factory;
import com.udapsoft.waf.system.Biz;
import com.udapsoft.waf.system.HandlerStorage;






public class TermsAgreeBiz extends Biz {

	public TermsAgreeBiz(HandlerStorage storage) 
	{
		super(storage);
	}

	/* (non-Javadoc)
	 * @see kr.co.hwenc.system.Biz#doBiz()
	 */
	public void doBiz() throws Exception 
	{

		
		//System.out.println("event==============>" + storage.getEvent());
		
		ValueObject corpInfoVo = new ValueObject();
		
		
		if(storage.compareEvent(""))
		{
		    //System.out.println("======================재무정보===========================");
		    
		}
		else if(storage.compareEvent("REGIST_IN"))
        {
            //System.out.println("======");
        }
		else if(storage.compareEvent("REG_COMPLETE"))
        {
            //System.out.println("====22==");
            ValueObject vo = new ValueObject();
            
            //평가 프로시저 호출(TEST시 주석처리, 운영반영시 주석 제거!!!!)
            vo = sp_reg_appr_set(storage.getParams()); 
            storage.addValueObject("apprComp", vo);
            
            //System.out.println("vo====================>" + vo);
            
            
            
            suppInfoStatusUpdate(params);
            
            
            MessageSend messageSend = new MessageSend(storage);
            
            /**************SMS, EMAIL*********************/
            //사용자 정보 가져오기
            RowSet userInfo = getUserInfo(params.get("corp_id")); 
            
            
            //SMS
            String smsContent = WAFMessages.getMessage("Register.Supplier.Complete");
            
            //System.out.println("smsContent===========>" + smsContent);
            String phon_no = userInfo.getRow(0).get("HP1") + userInfo.getRow(0).get("HP2") + userInfo.getRow(0).get("HP3");
            
            String re_phon_no = userInfo.getRow(0).get("SPH");//2015.10.16 외주구매 담당자
            messageSend.sendSMS(phon_no, re_phon_no, params.get("corp_id"), smsContent); //2015.9.21 대표번호  
            
            
            //EMAIL
            String subject = WAFMessages.getMessage("Register.Supplier.Complete.Mail.Title");
            String subject_in = WAFMessages.getMessage("Register.Supplier.Complete.Mail.Title.in");
            
            String email = userInfo.getRow(0).get("EMAIL");
            
            StringBuffer mailContent = new StringBuffer();
            mailContent.append("주식회사 <span class='style4'>"+ userInfo.getRow(0).get("CORP_KOR") + " 업체님 </span>께서 \n");
            mailContent.append( WAFMessages.getMessage("Register.Supplier.Complete.Mail.Content") );
            
            messageSend.sendEmail(email, "etec", subject, subject_in, mailContent);
            
            
            
            
            
        }
		else if(storage.compareEvent("CORP_CHECK"))
		{
		    ValueObject corp_id = getCorp_chk(super.conn.getConnection()); 
		    
		    storage.addValueObject("VALUEOBJECT", corp_id);
		}
		else if(storage.compareEvent("BASIC_INFO_REG"))
		{
		    ValueObject basicVo = new ValueObject();
		    
		    basicVo = getSuppJoinRequestList(params);
		    
		    storage.addValueObject("InfoBaseList", basicVo);
		    storage.addValueObject("TERMS_AGREE_INFO", getfilelist("TERMS_AGREE_INFO",basicVo.get("corp_id"),"TERMS_AGREE_INFO"));
		    
		    RowSet getFileListRowSet = getFileListRowSet("TERMS_AGREE_INFO_"+basicVo.get("corp_id"), "");
		    storage.addRowSet("getFileListRowSet", getFileListRowSet);
		}
		else if(storage.compareEvent("GET_LIST"))
        {
            RowSet rowset = null;
            
            if(params.get("job_div").equals("P"))
            {
                rowset = getList(params);
            }
            else
            {
                rowset = getList2(params);
            }
            
            
            //getList2
            
            Document xmlData = getXml(rowset);
            
            XMLOutputter xmlOutputter = new XMLOutputter();
            xmlOutputter.setFormat(Format.getRawFormat());
            
            //System.out.println(xmlOutputter.outputString(xmlData));
            
            storage.addObject("ibsheet7Data", xmlData);
        }
		else if(storage.compareEvent("CHECK_ID"))
		{
		    ValueObject check_id = new ValueObject();
		    
		    
		    check_id  = getSRegId(params);
		    
		    //System.out.println("==========>" + check_id.get("cnt"));
		    
            storage.addValueObject("VALUEOBJECT", check_id);
		    
		}
		else if(storage.compareEvent("GET_APPR_LIST"))
        {
            params.set("sheet3", geApprtList(params));
            storage.addObject("ibsheet7Data", IBSheet7Factory.createIBSheet7(params, storage.request));
        }
		else if(storage.compareEvent("ADD_INFO_REG"))
        {
		    RowSet rowSet = getOutLicMaster_searchCombo();
		    corpInfoVo = getCorpInfoList(params);
//		    
		    storage.addRowSet("licMasterList", rowSet);
		    storage.addValueObject("corpInfoVo", corpInfoVo);
        }
		else if(storage.compareEvent("ADD_INFO_LIST_IN"))
		{
		    
		    params.set("sheet1", getDeliverList(params)); //납품실적
            
            params.set("sheet2", getCertList(params)); //인증서

            params.set("sheet3", getSuppPrize(params)); //포상실적
            
            params.set("sheet4", getSuppPatTent(params)); //특허
            
            params.set("sheet5", getConAillty(params)); //건설면허(2020.06.22 추가)
            
            storage.addObject("ibsheet7Data", IBSheet7Factory.createIBSheet7(params, storage.request));
		}
		else if(storage.compareEvent("ADD_INFO_LIST_OUT"))
		{
		    params.set("sheet1", getContResult(params)); //계약실적
		    
		    params.set("sheet2", getConAillty(params)); //시공능력
		    
		    params.set("sheet3", getSuppTechMan(params)); //기술자격보유인력
		    
		    params.set("sheet4", getCertList(params)); //인증서
		    
		    storage.addObject("ibsheet7Data", IBSheet7Factory.createIBSheet7(params, storage.request));
		}
	}

	
	private ValueObject getfilelist(String filegb,String id,String returnid){
        ValueObject vo = new ValueObject();
        RowSet rowSet = FileManager.getFileList(filegb, id);
        String str="";
            for(int i=0;i<rowSet.size();i++){
                Row row=rowSet.getRow(i);
                str += (i+1)+" : "+row.get("FILE_NAME")+" ("+ row.get("FILE_SIZE")+")";
                if(i+1!=rowSet.size()){
                    str +="\r\n";
                }
            }
            vo.set(returnid, str);
        return vo;
    }
	
	
	
	/**
	 * rowset 데이터를 ibsheet에 맞는 xml 형식으로 변환한다.(트리메뉴 사용시)
	 * @param rowset
	 * @return
	 */
	public Document getXml(RowSet rowset)
    {
        
          Document doc = new Document();  
            
          Element root = new Element("Grid");
          
          Element pack = new Element("DATA");
          
          Element pack_tr = new Element("TR");
          
          Element pack_td = new Element("TD");
          
        try {

              root.addContent(pack);//root element 의 하위 element 를 만들기
              pack.addContent(pack_tr);
              pack_tr.addContent(pack_td);
              
              for(int i=0; i < rowset.size(); i++)
              {
                  if( i != 0)
                  {
                      pack_tr = new Element("TR");
                      pack.addContent(pack_tr);
                  }
                  
                  pack_tr.setAttribute("LEVEL", rowset.getRow(i).get("MATERIAL_LEVEL"));
                  
                  if( i != 0)
                  {
                      pack_td = new Element("TD");
                      pack_tr.addContent(pack_td);
                  }
                 
                  pack_td.addContent("<![CDATA[" + rowset.getRow(i).get("MATERIALGROUPNAME") + "]]>");
                  
                  pack_td = new Element("TD");
                  pack_tr.addContent(pack_td);
                  pack_td.addContent("<![CDATA[" + rowset.getRow(i).get("GUBUN_1") + "]]>");
                  
                  pack_td = new Element("TD");
                  pack_tr.addContent(pack_td);
                  pack_td.addContent("<![CDATA[" + rowset.getRow(i).get("GUBUN_2") + "]]>");
                  
                  pack_td = new Element("TD");
                  pack_tr.addContent(pack_td);
                  pack_td.addContent("<![CDATA[" + rowset.getRow(i).get("GUBUN_3") + "]]>");
                  
                  pack_td = new Element("TD");
                  pack_tr.addContent(pack_td);
                  pack_td.addContent("<![CDATA[" + rowset.getRow(i).get("MATERIAL_LEVEL") + "]]>");
                  
                  pack_td = new Element("TD");
                  pack_tr.addContent(pack_td);
                  pack_td.addContent("<![CDATA[" + rowset.getRow(i).get("MATERIALGROUP") + "]]>");
                  
                  
//                //System.out.println(rowset.getRow(i).get("GUBUN_1") + "/" + rowset.getRow(i).get("GUBUN_2") + "/" + rowset.getRow(i).get("GUBUN_3"));
              }
              
              doc.setRootElement(root);
              
              
                  
              } catch (Exception e) {                                         
                  System.err.println(e);                                        
              }
        return doc;
        
    }
    

    /**
     * 사용자 목록을 검색하여 리턴
     * @param Params
     * @return
     */
    private RowSet getList(ValueObject Params) {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlStr = new StringBuffer();
        
        try {
            sqlStr.append("     SELECT                                                                                                                  \n")
                    .append("        MATERIAL_LEVEL,    MATERIALGROUPNAME  ,   MATERIALGROUP,                                  \n")
                    .append("        GUBUN_1,                                                                                                             \n")
                    .append("        GUBUN_2,                                                                                                         \n")
                    .append("        GUBUN_3                                                                                                         \n")
                    .append("        FROM        PMM_MATERIALGROUP_V                                                                  \n");
            
            
            search.setStatement(sqlStr.toString());
            //System.out.println(sqlStr.toString());
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            //System.out.println(se);
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            se.printStackTrace();
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
            return rowSet;
        }
    }
    
    
    private RowSet getList2(ValueObject Params) {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlStr = new StringBuffer();
        
        try {
            sqlStr.append("     SELECT                                                                                                                  \n")
                    .append("        MATERIAL_LEVEL,    MATERIALGROUPNAME  ,   MATERIALGROUP,                                   \n")
                    .append("        LAST_VALUE(GUBUN_1 IGNORE NULLS) OVER(ORDER BY MATERIALGROUP) GUBUN_1,         \n")
                    .append("        LAST_VALUE(GUBUN_2 IGNORE NULLS) OVER(ORDER BY MATERIALGROUP) GUBUN_2,         \n")
                    .append("        LAST_VALUE(GUBUN_3 IGNORE NULLS) OVER(ORDER BY MATERIALGROUP) GUBUN_3          \n")
                    .append("        FROM                                                                                                                   \n")
                    .append("        (                                                                                                                          \n")
                    .append("            SELECT LEVEL-1 MATERIAL_LEVEL,    ITEM_CD AS MATERIALGROUP  , ITEM_NAME AS MATERIALGROUPNAME,              \n")  
                    .append("                        DECODE(LEVEL, '1', ITEM_NAME, '') GUBUN_1,                                 \n")
                    .append("                        DECODE(LEVEL, '2', ITEM_NAME, '') GUBUN_2,                                 \n")
                    .append("                        DECODE(LEVEL, '3', ITEM_NAME, '') GUBUN_3                                  \n")
                    .append("                        FROM(                                                                                                  \n")                                                                                           
                    .append("                                SELECT ITEM_CD,                                                                     \n")                                                       
                    .append("                                           KIND_BIG,                                                                 \n")                      
                    .append("                                           KIND_MID,                                                                   \n")
                    .append("                                           ITEM_NAME,                                                                  \n")
                    .append("                                           PARENT_LEVEL,                                                          \n")
                    .append("                                           DEPTH                                                                      \n")
                    .append("                                       FROM OUT_ITEM                                                      \n")
                    .append("                                )                                                                                                  \n")
                    .append("                 START WITH PARENT_LEVEL = 'S'                                                                      \n")
                    .append("                     CONNECT BY PRIOR ITEM_CD = PARENT_LEVEL                                      \n")
                    .append("                     AND LEVEL <= 3                                                                                         \n")
                    .append("                     ORDER SIBLINGS BY PARENT_LEVEL ASC, ITEM_NAME ASC                         \n")
                    .append("            )                                                                                                                       \n");
            
                
            //Paging 처리를 위한 Helper Object 생성
            super.createPageAnchorInfo();
            //한페이지에 가져올 목록의 갯수 지정(미지정시  waf.properties 파일의 기본값을 사용)
            super.anchor.range = 10000;
            //Paging 처리에 사용될 Parameter를  세팅
            super.anchor.setParams(this.params);
            //검색할  SQL 세팅 : SQL은 Paging처리를 하지 않고 작성
            super.anchor.setSQL(sqlStr.toString());
            //전체 Record 숫자를 조회
            super.anchor.doTotalCountSQL(); // 전체 숫자를 조회
            
            //Paging처리가 된 SQL을 Helper Object에서 가져옴
            String temp = super.anchor.getPagingSQL();
            
            search.setStatement(temp);
            //System.out.println(sqlStr.toString());
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            se.printStackTrace();
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
            return rowSet;
        }
    }
	
    
    public ValueObject getCorp_chk(Connection conn) throws Exception{
        
        Persistent persistent_q = null;
        
        
        ValueObject vo = new ValueObject();
        ValueObject row = null;
        StringBuffer sqlstr =  new StringBuffer();
        
        try{
            persistent_q = new PersistentImpl(conn);
            
            sqlstr.append("         SELECT COUNT(*) CNT, CHK_CREDIT(MAX(A.CORP_ID))  GUBUN, MAX(A.CORP_ID) CORP_ID, MAX(STATUS) STATUS                                                           \n");
            sqlstr.append("             FROM SUPP_INFO A, SUPP_CHARGE B                                                                  \n");
            sqlstr.append("         WHERE A.CORP_ID = B.CORP_ID AND B.DEFAULT_YN = 'Y'  AND CORP_REG_NO = ? AND JOB_DIV = ?        \n");
            
            persistent_q.setStatement(sqlstr.toString()); 
            persistent_q.addParameter(params.get("corp_no"));
            persistent_q.addParameter(params.get("job_div"));
            
            WAFLogger.debug(persistent_q.getParameters());
            WAFLogger.debug(sqlstr);
            
            row = RowSetUtility.getValueObject(persistent_q.query().getRow(0));
            vo.set("cnt", row.get("CNT"));
            vo.set("gubun", row.get("GUBUN"));
            vo.set("corp_id", row.get("CORP_ID"));
            vo.set("status", row.get("STATUS"));
        }
        catch(Exception e) {
            e.printStackTrace();
        }finally{
            if(vo == null) vo = new ValueObject();
        }
        return vo;
    }
    
    
    public ValueObject getSuppJoinRequestList(ValueObject params){
        Search search = new SearchImpl();
        ValueObject vo = null;
        RowSet rowSet = new RowSetImpl();
        
        StringBuffer sqlstr = new StringBuffer();
        
        
        try{
			sqlstr.append("SELECT A.CORP_REG_NO	--  사업자등록번호 												\n")
				  .append("		  ,NVL(A.COPR_NO,C.COPR_NO) COPR_NO -- 법인번호									\n")
				  .append("		  ,A.CORP_KOR	--  업체명한글 													\n")
			      .append("		  ,A.REP_NAME	--  대표자명 													\n")
			      .append("		  ,NVL(A.CORP_DIV_CD,C.CORP_DIV_CD) CORP_DIV_CD	--  사업자구분코드 				\n")
			      .append("		  ,A.REG_REQ_DT	--  회원가입요청일시 											\n")
			      .append("		  ,A.CRE_DATE	--  등록일시 													\n")
			      .append("		  ,F_GET_CODE_NAME('SUPP_INFO_STATUS',A.STATUS) STATUS -- 업체진행상태			\n")
			      .append("		  ,B.USER_NAME	--  담당자명 													\n")
			      .append("		  ,B.EMAIL  	--	이메일 														\n")                       
			      .append("		  ,B.HP1		--	휴대폰1 													\n")
			      .append("		  ,B.HP2		--	휴대폰2 													\n")
			      .append("		  ,B.HP3		--	휴대폰3 													\n")
			      .append("		  ,A.CORP_ID  	--  협력업체 ID													\n")
			      .append("		  ,B.CHARGE_SEQ	--	회원일련번호 												\n")                             
			      .append("		  ,B.USER_ID	--	아이디 														\n")
			      .append("		  ,B.TEL_NUM	--	전화번호 													\n")               
			      .append("		  ,B.DIVISION	--	부서 														\n")
			      .append("		  ,B.POSITION	--	직위 														\n")
			      .append("		  ,B.FAX_NUM  	--	팩스 														\n")
			      .append("		  ,NVL(A.CORP_STS,C.CORP_STS) CORP_STS	--  업태								\n")
			      .append("		  ,NVL(A.BIZ_FORM,C.BIZ_FORM) BIZ_FORM 	--  업종								\n")
			      .append("		  ,CASE WHEN REGEXP_REPLACE(NVL(TO_CHAR(A.ESTA_DATE,'YYYY-MM-DD'),C.ESTA_DATE),'[^0-9]') IS NOT NULL THEN TO_CHAR(TO_DATE(REGEXP_REPLACE(NVL(TO_CHAR(A.ESTA_DATE,'YYYY-MM-DD'),C.ESTA_DATE),'[^0-9]'),'YYYYMMDD'),'YYYY-MM-DD') END ESTA_DATE -- 설립일자 \n")
			      .append("		  ,NVL(A.CORP_TEL,C.CORP_TEL) CORP_TEL	--  전화번호 							\n")
			      .append("		  ,NVL(A.CORP_FAX,C.CORP_FAX) CORP_FAX	--	FAX번호 							\n")
			      .append("		  ,NVL(A.CORP_SCALE,C.CORP_SCALE) CORP_SCALE	--  회사규모코드 				\n")
			      .append("		  ,NVL(A.POST_NO,C.POST_NO) POST_NO	--  본점 우편번호 							\n")
			      .append("		  ,NVL(A.ADDRESS,C.ADDRESS) ADDRESS	--  본점 주소 								\n")
			      .append("		  ,NVL(A.PLACE_POST_NO,C.PLACE_POST_NO) PLACE_POST_NO	--  사업장 우편번호 	\n")
			      .append("		  ,NVL(A.PLACE_ADDRESS,C.PLACE_ADDRESS)   PLACE_ADDRESS	-- 사업장 주소 			\n")
			      .append("		  ,NVL(A.CREDIT_CORP_CD,C.CREDIT_CORP_CD) CREDIT_CORP_CD	-- 신용평가사코드	\n")
			      .append("		  ,NVL(A.CREDIT_GRADE,C.CREDIT_GRADE) CREDIT_GRADE	-- 신용등급 				\n")
			      .append("		  ,NVL(A.CASH_GRADE,C.CASH_GRADE) CASH_GRADE		--  현금흐름등급 			\n")
			      .append("		  ,NVL(A.CREDIT_STA_DY,C.CREDIT_STA_DY) CREDIT_STA_DY	--  신용평가조사일 		\n")
			      .append("		  ,NVL(A.CREDIT_END_DY,C.EXPIRE_DATE) CREDIT_END_DY		--  신용평가만료일 		\n")
			      .append("		  ,NVL(A.FACTOR_CD,C.FACTOR_CD) FACTOR_CD	--  공장유무 						\n")
			      .append("		  ,NVL(A.MFTR_DIV_CD,C.MFTR_DIV_CD) MFTR_DIV_CD	--	MANUFACTURER 구분 			\n")
			      .append("  FROM SUPP_INFO A 																	\n")
			      .append("		  ,SUPP_CHARGE B 																\n")
			      .append("		  ,SUPP_INFO_V C 																\n")
			      .append(" WHERE A.CORP_ID = ? 																\n")
			      .append("	  AND B.DEFAULT_YN = 'Y' 															\n")
			      .append("	  AND A.CORP_ID = B.CORP_ID 														\n")
			      .append("	  AND A.CORP_REG_NO = C.CORP_REG_NO(+) 												\n")
			      .append("	  AND C.CREDIT_CORP_CD(+) = CHK_CREDIT(?) 											\n");
            
            search.setStatement(sqlstr.toString());
            search.addParameter(params.get("corp_id"));
            search.addParameter(params.get("corp_id"));
            rowSet = search.execute();
            
            
            if(rowSet.size()>0){
                vo = RowSetUtility.getValueObject(rowSet.getRow(0));
            }
            
        }catch(Exception e){
            //System.out.println("getSuppJoinRequestList===>" + e);
            e.printStackTrace();
            throw e;
        }finally{
            if( vo == null) vo = new ValueObject();
            return vo;
        }
    } 
    
    
    public ValueObject getSRegId(ValueObject params){
        Search search = new SearchImpl();
        ValueObject vo = null;
        RowSet rowSet = new RowSetImpl();
        
        StringBuffer sqlstr = new StringBuffer();
        
        
        try{
            
            sqlstr.append("      SELECT                                                                                     \n")                    
                   .append("              COUNT(*) CNT                                                                                                            \n")
                   .append("            FROM SUPP_CHARGE                                                                                                            \n")                            
                   .append("         WHERE UPPER(USER_ID) = UPPER(?)                                                                                                       \n")
                   .append("         AND CORP_ID != ?                                                                                                       \n");
            
            search.setStatement(sqlstr.toString());
            search.addParameter(params.get("user_id").trim());
            search.addParameter(params.get("corp_id").trim());
            rowSet = search.execute();
            
            
            //System.out.println(sqlstr.toString());
            //System.out.println(search.getParameters());
            
            if(rowSet.size()>0){
                vo = RowSetUtility.getValueObject(rowSet.getRow(0));
            }
            
        }catch(Exception e){
            e.printStackTrace();
            throw e;
        }finally{
            if( vo == null) vo = new ValueObject();
            return vo;
        }
    } 
    
    
    private RowSet geApprtList(ValueObject Params) {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlStr = new StringBuffer();
        
        try {
            sqlStr.append("            SELECT     \n")
                   .append("                     'Y' CREDIT_YN        \n")
                   .append("                    ,TO_CHAR( TO_DATE(MAX(A.SUVDT), 'YYYY-MM-DD'), 'YYYY-MM-DD') SUVDT        \n")
                   .append("                    , DECODE(A.EVAL_CMP, 'E', '이크레더블', 'S', '서울신용평가', 'N', '나이스디앤비', 'K', '한국기업데이터', 'M', '나이스평가정보', '없음') EVAL_CMP     \n")
                   .append("                    , LASTGRD2        \n")
                   .append("                    , DECISION        \n")
                   .append("                    , MAX(EXPIRE_DATE) EXPIRE_DATE         \n")
                   .append("                    , CHK_CREDIT(C.CORP_ID) CREDIT_GUBUN     \n")
                   .append("                    , A.EVAL_CMP GUBUN_CODE     \n")
                   .append("                     FROM DCC_PACKET01 A, DCC_PACKET11 B, SUPP_INFO C     \n")
                   .append("                    WHERE A.RESNO = B.RESNO     \n")
                   .append("                    AND A.SUVDT = B.SUVDT     \n")
                   .append("                    AND B.RESNO = C.CORP_REG_NO   \n")
                   .append("                    AND C.CORP_ID = ?   \n")
                   .append("                    AND A.EXPIRE_DATE > TO_CHAR(SYSDATE, 'YYYYMMDD')   \n")
                   .append("                    GROUP BY A.EVAL_CMP, A.LASTGRD2, B.DECISION, C.CORP_ID    \n");
                                               
            
            
            /*   
            //Paging 처리를 위한 Helper Object 생성
            super.createPageAnchorInfo();
            //한페이지에 가져올 목록의 갯수 지정(미지정시  waf.properties 파일의 기본값을 사용)
            super.anchor.range = 10000;
            //Paging 처리에 사용될 Parameter를  세팅
            super.anchor.setParams(this.params);
            //검색할  SQL 세팅 : SQL은 Paging처리를 하지 않고 작성
            super.anchor.setSQL(sqlStr.toString());
            //전체 Record 숫자를 조회
            super.anchor.doTotalCountSQL(); // 전체 숫자를 조회
            
            //Paging처리가 된 SQL을 Helper Object에서 가져옴
            String temp = super.anchor.getPagingSQL();
            */
            
            
            
            search.setStatement(sqlStr.toString());
            search.addParameter(params.get("corp_id"));
            //System.out.println(sqlStr.toString());
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            //System.out.println("getList2=========>" + se);
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            se.printStackTrace();
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
            return rowSet;
        }
    }
    
    
    
    private RowSet getDeliverList(ValueObject Params) {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlStr = new StringBuffer();
        
        try {
            sqlStr.append("            SELECT DELI_CORP_NM -- 납품처명                      \n")
                   .append("                      ,DELI_CORP_NO-- 납품처사업자번호                      \n")
                   .append("                      ,ITEM_NM -- 품목명                      \n")
                   .append("                      ,CONT_AMT -- 계약금액                      \n")
                   .append("                      ,QTY -- 수량                      \n")
                   .append("                      ,STD -- 규격                      \n")
                   .append("                      ,DELI_START_DY -- 납품시작일부                      \n")
                   .append("                      ,DELI_END_DY -- 납품종료일                      \n")
                   .append("                      ,CREDIT_YN -- 신용평가반영여                      \n")
                   .append("                      FROM SUPP_PUR_DELIRESULT_V                      \n")
                   .append("                      WHERE RESNO = ?                      \n");
                                               
            
            
            /*   
            //Paging 처리를 위한 Helper Object 생성
            super.createPageAnchorInfo();
            //한페이지에 가져올 목록의 갯수 지정(미지정시  waf.properties 파일의 기본값을 사용)
            super.anchor.range = 10000;
            //Paging 처리에 사용될 Parameter를  세팅
            super.anchor.setParams(this.params);
            //검색할  SQL 세팅 : SQL은 Paging처리를 하지 않고 작성
            super.anchor.setSQL(sqlStr.toString());
            //전체 Record 숫자를 조회
            super.anchor.doTotalCountSQL(); // 전체 숫자를 조회
            
            //Paging처리가 된 SQL을 Helper Object에서 가져옴
            String temp = super.anchor.getPagingSQL();
            */
            
            
            
            search.setStatement(sqlStr.toString());
            search.addParameter(params.get("corp_reg_no"));
            
            
            //System.out.println(sqlStr.toString());
            
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            //System.out.println("getDeliverList=========>" + se);
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            se.printStackTrace();
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
            return rowSet;
        }
    }
    
    
    private RowSet getCertList(ValueObject Params) {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlStr = new StringBuffer();
        
        try {
            sqlStr.append("            SELECT CERT_DIV_CD -- 종류코드                             \n")
                   .append("                     ,CERT_NO -- 인증번호                             \n")
                   .append("                     ,CERT_CTNT -- 인증명                             \n")
                   .append("                     ,CERT_SCOPE -- 인증범위                             \n")
                   .append("                     ,CERT_GOV -- 인증기관                             \n")
                   .append("                     ,EXP_STA_DY -- 취득일                             \n")
                   .append("                     ,EXP_END_DY-- 만료일                             \n")
                   .append("                     ,CREDIT_YN -- 신용평가반영여부                             \n")
                   .append("                     FROM SUPP_CERT_V                             \n")
                   .append("                     WHERE RESNO = ?                             \n")
                   .append("                     AND EXP_END_DY = (SELECT MAX(EXP_END_DY) FROM SUPP_CERT_V WHERE RESNO = ?  )                           \n");
                                               
            
            
            /*   
            //Paging 처리를 위한 Helper Object 생성
            super.createPageAnchorInfo();
            //한페이지에 가져올 목록의 갯수 지정(미지정시  waf.properties 파일의 기본값을 사용)
            super.anchor.range = 10000;
            //Paging 처리에 사용될 Parameter를  세팅
            super.anchor.setParams(this.params);
            //검색할  SQL 세팅 : SQL은 Paging처리를 하지 않고 작성
            super.anchor.setSQL(sqlStr.toString());
            //전체 Record 숫자를 조회
            super.anchor.doTotalCountSQL(); // 전체 숫자를 조회
            
            //Paging처리가 된 SQL을 Helper Object에서 가져옴
            String temp = super.anchor.getPagingSQL();
            */
            
            
            
            search.setStatement(sqlStr.toString());
            search.addParameter(params.get("corp_reg_no"));
            search.addParameter(params.get("corp_reg_no"));
            
            //System.out.println(sqlStr.toString());
            
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            //System.out.println("getCertList=========>" + se);
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            se.printStackTrace();
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
            return rowSet;
        }
    }
    
    
    
    private RowSet getSuppPrize(ValueObject Params) {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlStr = new StringBuffer();
        
        try {
            sqlStr.append("           SELECT PRZ_DY -- 수상일              \n")
                   .append("                     ,PRZ_NM -- 수상자              \n")
                   .append("                     ,PRZ_GIVER -- 수여자              \n")
                   .append("                     ,PRZ_INFO -- 수상내용              \n")
                   .append("                     ,CREDIT_YN -- 신용평가반영여부              \n")
                   .append("                     FROM SUPP_PRIZE_V              \n")
                   .append("                     WHERE RESNO = ?              \n");
            
            
            
            /*
              sqlStr.append("           SELECT  PRZ_DY -- 수상일              \n")
                   .append("                     , PRZ_NM -- 수상자              \n")
                   .append("                     , PRZ_GIVER -- 수여자              \n")
                   .append("                     , PRZ_INFO -- 수상내용              \n")
                   .append("                     FROM SUPP_PRIZE              \n")
                   .append("                     WHERE CORP_ID = ?              \n");
             
             */
                                               
            
            
            search.setStatement(sqlStr.toString());
            search.addParameter(params.get("corp_reg_no"));
            //System.out.println(sqlStr.toString());
            
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            //System.out.println("getSuppPrize=========>" + se);
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            se.printStackTrace();
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
            return rowSet;
        }
    }
    
    
    private RowSet getSuppPatTent(ValueObject Params) {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlStr = new StringBuffer();
        
        try {
            sqlStr.append("          SELECT PAT_CD -- 산업재산권 구분        \n")
                    .append("                    ,PAT_DY -- 특허일        \n")
                    .append("                    ,PAT_INFO -- 명칭        \n")
                    .append("                    ,CREDIT_YN -- 신용평가반영여부        \n")
                    .append("                    FROM SUPP_PATENT_V        \n")
                    .append("                    WHERE RESNO = ?                                             \n");
            
            
            
            search.setStatement(sqlStr.toString());
            search.addParameter(params.get("corp_reg_no"));
            
            //System.out.println(sqlStr.toString());
            //System.out.println(search.getParameters());
            
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            //System.out.println("getSuppPrize=========>" + se);
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            se.printStackTrace();
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
            return rowSet;
        }
    }
    
    
    private RowSet getContResult(ValueObject Params) {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlStr = new StringBuffer();
        
        try {
            sqlStr.append("          SELECT BASE_YEAR-- 기준년도                     \n")
                    .append("                 ,LIC_CD -- 면허코드                     \n")
                    .append("                 ,LIC_NM -- 면허코드                     \n")
                    .append("                 ,CONT_NM -- 공사명                     \n")
                   .append("                 ,CONT_NM -- 공사명                     \n")
                   .append("                 ,ORDR_ORG_NM -- 발주자명                     \n")
                   .append("                 ,ORDR_NM -- 도급자명                     \n")
                   .append("                 ,CONT_AMT-- 당해년도 계약금액                     \n")
                   .append("                 ,CONT_DY -- 계약년월                     \n")
                   .append("                 ,CONT_STA_DY -- 착공년월                     \n")
                   .append("                 ,CONT_END_DY -- 준공년월                     \n")
                   .append("                 ,CREDIT_YN -- 신용평가반영여부                     \n")
                   .append("                 FROM SUPP_CONT_RESULT_V                    \n")
                   .append("                 WHERE RESNO = ?                     \n");
            
            
            
            search.setStatement(sqlStr.toString());
            search.addParameter(params.get("corp_reg_no"));
            
            
            //System.out.println(sqlStr.toString());
            //System.out.println(search.getParameters());
            
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            //System.out.println("getContResult=========>" + se);
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            se.printStackTrace();
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
            return rowSet;
        }
    }
    
    
    private RowSet getConAillty(ValueObject Params) {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlStr = new StringBuffer();
        
        try {
            sqlStr.append("         SELECT BASE_YEAR-- 기준년도                   \n")
                   .append("                    , LIC_NM -- 면허명                   \n")
                   .append("                    , LIC_NO-- 면허번호                   \n")
                   .append("                    , LIC_CD-- 면허코드                   \n")
                   .append("                    ,CON_ABI_AMT-- 시공능력평가액                   \n")
                   .append("                    ,AREA_LANK-- 지역순위                   \n")
                   .append("                    ,AREA_ALL_LANK-- 지역순위 전체                   \n")
                   .append("                    ,NATION_LANK -- 전국순위                   \n")
                   .append("                    ,NATION_ALL_LANK-- 전국순위전체                   \n")
                   .append("                    ,CREDIT_YN -- 신용평가반영여부                   \n")
                   .append("                    FROM SUPP_CON_ABILLTY_V                   \n")
                   .append("                    WHERE RESNO = ?                                        \n")
                   .append("                    ORDER BY BASE_YEAR DESC             \n");   
            
            
            
            search.setStatement(sqlStr.toString());
            search.addParameter(params.get("corp_reg_no"));
            
            //System.out.println(sqlStr.toString());
            //System.out.println(search.getParameters());
            
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            //System.out.println("getConAillty=========>" + se);
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            se.printStackTrace();
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
            return rowSet;
        }
    }
    
    
    
    private RowSet getSuppTechMan(ValueObject Params) {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlStr = new StringBuffer();
        
        try {
            sqlStr.append("         SELECT NM-- 이름                                      \n")
                   .append("                 ,SUBSTR(BIRTHDAY,0,6) BIRTHDAY-- 생년월일                             \n")
                   .append("                 ,POSITION-- 지위                             \n")
                   .append("                 ,QUAL_ITEM_CLASS -- 자격종목 및 등급                             \n")
                   .append("                 ,REG_NO -- 등록번호                             \n")
                   .append("                 ,FILED -- 분야                             \n")
                   .append("                 ,TECH_CLASS-- 기술등급                             \n")
                   .append("                 ,CREDIT_YN -- 신용평가반영여부                             \n")
                   .append("                 FROM SUPP_TECH_MAN_V                             \n")
                   .append("                 WHERE RESNO = ?                             \n");
            
            
            
            search.setStatement(sqlStr.toString());
            search.addParameter(params.get("corp_reg_no"));
            
            //System.out.println(sqlStr.toString());
            //System.out.println(search.getParameters());
            
            rowSet = search.execute();
        }
        catch (WAFSQLException se) {
            //System.out.println("getConAillty=========>" + se);
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
            se.printStackTrace();
        }
        finally {    
            if(rowSet == null) rowSet = new RowSetImpl();
            return rowSet;
        }
    }
    
    
    
    
    
    public ValueObject getCorpInfoList(ValueObject params){
        Search search = new SearchImpl();
        ValueObject vo = null;
        RowSet rowSet = new RowSetImpl();
        
        StringBuffer sqlstr = new StringBuffer();
        
        
        try{
            
                sqlstr.append("     SELECT        BASE_YEAR-- 기준년도                                \n")
                        .append("                     ,CAPITAL_AMT -- 자본금                                \n")
                        .append("                     ,FLOAT_ASSET -- 유동자산                                \n")
                        .append("                     ,FLOAT_DEBT -- 유동부채                                \n")
                        .append("                     ,OWN_CAP-- 자기자본                                \n")
                        .append("                     ,TOT_CAP -- 총자본                                \n")
                        .append("                     ,CUR_PROFIT-- 당기순이익                                \n")
                        .append("                     ,GROSS_ASSET-- 총자산                                \n")
                        .append("                     ,SALES_AMT-- 매출액                                \n")
                        .append("                     ,CUR_SALES_AMT -- 당기매출액                                \n")
                        .append("                     ,PRI_SALES_AMT -- 전기매출액                                \n")
                        .append("                     FROM SUPP_FINANCE_V                                \n")
                        .append("                     WHERE RESNO = ?                                \n");
            
            
            search.setStatement(sqlstr.toString());
            search.addParameter(params.get("corp_reg_no"));
            
            
            //System.out.println("getCorpInfoList===>" + sqlstr.toString());
            //System.out.println("getCorpInfoList===>" + search.getParameters());
            
            rowSet = search.execute();
            
            if(rowSet.size()>0){
                vo = RowSetUtility.getValueObject(rowSet.getRow(0));
            }
            
        }catch(Exception e){
            e.printStackTrace();
            //System.out.println("getCorpInfoList===>" + e);
            
        }finally{
            if( vo == null) vo = new ValueObject();
            return vo;
        }
    }
    
    public ValueObject sp_reg_appr_set(ValueObject Params) throws Exception { 
        
        CallableStatement cs = null;
        ValueObject rtnVo = new ValueObject();
        
        try {
            conn.begin();                       
            String corp_id   = params.get("corp_id");
            
            String sqlStr = "{call SP_REG_APPR_SET(?, ?, ?)}";
            
            cs = super.conn.getConnection().prepareCall(sqlStr);
            cs.setString(1, corp_id);
            cs.registerOutParameter(2, java.sql.Types.VARCHAR);
            cs.registerOutParameter(3, java.sql.Types.VARCHAR);
            cs.execute();
            
            rtnVo.set("OUT_SUCCESS_CD",cs.getString(2));
            rtnVo.set("OUT_MESSAGE",cs.getString(3));
            return rtnVo;
            
        }
        catch(Exception e) {
            super.doException(e);
            rtnVo.set("OUT_SUCCESS_CD",cs.getString(24));
            rtnVo.set("errMsg",cs.getString(3));
            super.conn.setRollback();
            this.storage.setSuccess(false);
            this.storage.setMessage(e.getMessage());
            return rtnVo;
        }
        finally {
            super.conn.end();
        }
    }
    


    public RowSet getOutLicMaster_searchCombo(){
    
        Search search = new SearchImpl();
        RowSet listRowSet = null;
        String sqlstr = "";
        
        try {
            sqlstr = " SELECT LIC_CD, LIC_NM  FROM OUT_LIC_MASTER ORDER BY LIC_CD ASC                 \n";
             
            search.setStatement(sqlstr);
            
            //System.out.println("search=======>" + sqlstr);
            listRowSet = search.execute();
            
        }catch(Exception e){
            //System.out.println(e);
            e.printStackTrace();
        }finally{
    
            if( listRowSet == null ){
                listRowSet = new RowSetImpl();
            }
            
            return listRowSet;
        }
    }
        
    private boolean suppInfoStatusUpdate(ValueObject params) throws Exception
    {
        
        Persistent persistent = null;
        StringBuffer sqlstr = new StringBuffer();
        
        
        try{
            
            conn.begin();
            persistent = new PersistentImpl(super.conn.getConnection());
            
            
            sqlstr.append("     UPDATE SUPP_INFO SET            \n")
                   .append("           STATUS = ?           \n")
                   .append("          ,REG_DT = SYSDATE           \n")
                   .append("      WHERE CORP_ID = ?                 \n");
            
            
            persistent.setStatement(sqlstr.toString());
            persistent.addParameter("01");
            persistent.addParameter(params.get("corp_id"));
            
            //System.out.println(sqlstr.toString());
            //System.out.println(persistent.getParameters());
            
            persistent.execute();
            persistent.clearParameters();
            
            return true;
            
            
        } catch(Exception e) {
            //System.out.println("updateInfo====>" + e);
            e.printStackTrace();
            conn.setRollback();
            throw e;
            
        }
        
        finally {
            super.conn.end();
        }
    }
    
    
    public RowSet getUserInfo(String corp_id) throws Exception{
        
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        
        StringBuffer sqlstr = new StringBuffer();       
        
        try {
            sqlstr.append(" SELECT USER_NAME, HP1, HP2, HP3, A.REP_NAME, B.EMAIL, A.CORP_KOR , C.DETAILNM SPH  \n");
            sqlstr.append(" FROM SUPP_INFO A, SUPP_CHARGE B , EBID_COM911T C           \n");
            sqlstr.append(" WHERE A.CORP_ID = B.CORP_ID          \n");
            sqlstr.append(" AND B.DEFAULT_YN = 'Y'               \n");
            sqlstr.append(" AND A.CORP_ID = "+corp_id+"          \n");
            sqlstr.append(" AND C.BASECD = 'SMS'                 \n");
            sqlstr.append(" AND C.DETAILCD = A.JOB_DIV           \n");
            //System.out.println(sqlstr.toString());
            
            search.setStatement(sqlstr.toString());
            rowSet = search.execute();            
        }
        catch(WAFSQLException se) {
            //System.out.println("SQL : \n" + sqlstr.toString());
            //System.out.println("PARAM : \n" + se.getParameter());
            //System.out.println(se);
            se.printStackTrace();
            throw se;
        }
        finally {
            if( rowSet == null ) rowSet = new RowSetImpl();
            return rowSet;
        }
    }

    

    /**
   	 * 이메일 전송 메소드(Javamail 사용)
   	 * @param user
   	 * @param from_email
   	 * @param to_name
   	 * @param to_email
   	 */
       public void sendEmail(String toEmail, String sendUser, String mailSubject, String subSubject, StringBuffer mailContent, String gubun) throws Exception{
   		
       	Date today=new Date();
           SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd");       
           String date = formater.format(today);
           
   		// 메일서버 정보와 실제 서버의 주소를 가져온다.
   		RowSet smtpInfo = getSmtpInfo(); 
   		String smtpIp 	= smtpInfo.getRow(0).get("CHG_CODE01");
   		String smtpUser = smtpInfo.getRow(0).get("CHG_CODE02");
   		String smtpPw 	= smtpInfo.getRow(0).get("CHG_CODE03");
   		String link 	= smtpInfo.getRow(0).get("CHG_CODE04");
   		String linkPortal 	= smtpInfo.getRow(0).get("CHG_CODE05");
   		 	   sendUser = smtpInfo.getRow(0).get("CHG_CODE06");
   		/*
   		RowSet userInfo = getUserInfo(sendUser); 
   		String fromEmail = userInfo.getRow(0).get("E_MAIL");
   		String fromName = userInfo.getRow(0).get("USER_NM");
   		String fromDuty = userInfo.getRow(0).get("A_DUTY");
   		String fromDept = userInfo.getRow(0).get("DEPART_DEPT_NM");
   		String fromTel = userInfo.getRow(0).get("TEL_NO");
   		*/
   		Properties properties = new Properties();									// Properties 객체 설정
   		properties.put("mail.transport.protocol", "smtp");							// SMTP 프로토콜 사용
   		properties.put("mail.smtp.host", smtpIp);									// 메일서버 주소 설정
   		properties.put("mail.smtp.port", "25");										// 메일서버 포트 설정
   		properties.put("mail.smtp.auth", true);										// 인증 사용 여부
   		
   		SmtpAuth auth = new SmtpAuth(smtpUser, smtpPw);								// SMTP 인증을 위해서 반드시 필요하다
   		
   		StringBuffer contentBase = new StringBuffer();
   				
   		
   		if(gubun.equals("P")){
   			contentBase.append("				<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>																																		\n");
   			contentBase.append("				<html xmlns='http://www.w3.org/1999/xhtml'>                                                                                                                                                                                                                     \n");
   			contentBase.append("				<head>                                                                                                                                                                                                                                                          \n");
   			contentBase.append("				<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />                                                                                                                                                                                          \n");
   			contentBase.append("				<title>:::협력업체포탈_mailing:::</title>                                                                                                                                                                                                                       	\n");
   			contentBase.append("				<style type='text/css'>                                                                                                                                                                                                                                         \n");
   			contentBase.append("				<!--                                                                                                                                                                                                                                                            \n");
   			contentBase.append("				.style1 {color: #3366CC;font-weight: bold;font-size: 24px; border-bottom:#3366CC dotted 2px;}                                                                                                                                                                   \n");
   			contentBase.append("				.popup_table{width:800px; font-family:dotum; font-size:12px; color:#666666; text-align:left;}                                                                                                                                                                   \n");
   			contentBase.append("				.text_red{font-size:12px; color:#cc0000; height:25px; text-align:left; vertical-align:top; text-indent:10px;}                                                                                                                                                   \n");
   			contentBase.append("				.popup_logo{ background-image:url("+link+"/img/email/popup_logo.gif) ; background-repeat:no-repeat; width:232px;}                                                                                                                                                              \n");
   			contentBase.append("				.popup_title{font-family:dotum; font-size:12px;  text-indent:10px;}                                                                                                                                                                                             \n");
   			contentBase.append("				.td_01{ height:28px; background-color:#f5f9fe; line-height:28px; text-indent:20px; border-top:#cccccc solid 1px; border-right:#cccccc solid 1px; width:130px; font-weight:bold; color:#333333;}                                                                 \n");
   			contentBase.append("				.td_01_2{ height:28px; background-color:#f5f9fe; line-height:28px; text-indent:20px; border-top:#cccccc solid 1px; border-right:#cccccc solid 1px;border-bottom:#cccccc solid 1px; width:130px; font-weight:bold; color:#333333;}                               \n");
   			contentBase.append("				.td_02{ height:28px;line-height:28px;border-top:#cccccc solid 1px; text-indent:20px; font-weight:bold; color:#2f63ac;}                                                                                                                                          \n");
   			contentBase.append("				.td_02_2{ height:28px;line-height:28px; text-indent:5px; color:#2f63ac;}                                                                                                                                                                                        \n");
   			contentBase.append("				.td_02_3{ line-height:16px; color:#2f63ac; font-size:11px;}                                                                                                                                                                                                     \n");
   			contentBase.append("				.td_03{ height:300px;line-height:20px;border-top:#cccccc solid 1px; color:#333333; padding:20px;}                                                                                                                                                               \n");
   			contentBase.append("				.td_04{ height:28px;line-height:28px;border-top:#cccccc solid 1px; text-indent:20px; color:#666666;border-bottom:#cccccc solid 1px;}                                                                                                                            \n");
   			contentBase.append("				.text01{width:auto; font-size:12px; line-height:18px; padding:5px; text-align:left;}                                                                                                                                                                            \n");
   			contentBase.append("				.text_icon4{color:#ccc; font-size:12px; line-height:16px; width:15px; font-weight:bold;}                                                                                                                                                                        \n");
   			contentBase.append("				.style2 {                                                                                                                                                                                                                                                       \n");
   			contentBase.append("					font-size: 18px;                                                                                                                                                                                                                                            \n");
   			contentBase.append("					font-weight: bold;                                                                                                                                                                                                                                          \n");
   			contentBase.append("				}                                                                                                                                                                                                                                                               \n");
   			contentBase.append("				.style3 {font-size:12px; color:#3366CC; height:25px; text-align:left; vertical-align:top; text-indent:10px;}                                                                                                                                                    \n");
   			contentBase.append("				.style4 {color: #3366CC;font-weight: bold;font-size: 14px;}                                                                                                                                                                                                     \n");
   			contentBase.append("				</style>                                                                                                                                                                                                                                                        \n");
   			contentBase.append("				</head>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				<body style='padding:0px; margin:0px;'>                                                                                                                                                                                                                         \n");
   			contentBase.append("				<div align='center'>                                                                                                                                                                                                                                            \n");
   			contentBase.append("				 <table border='0' cellpadding='0' cellspacing='0' class='popup_table' style='width:800px; font-family:dotum; font-size:12px; color:#666666; text-align:left;'>                                                                                                                                                                                         \n");
   			contentBase.append("				  <tr>                                                                                                                                                                                                                                                          \n");
   			contentBase.append("				   <td>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				    <table border='0' cellpadding='0' cellspacing='0' style='width:800px; height:62px; background-image:url("+link+"/img/email/img_mail_title.gif); background-repeat:no-repeat;'>                                                                                             \n");
   			contentBase.append("				     <tr>                                                                                                                                                                                                                                                       \n");
   			contentBase.append("				      <td class='popup_logo'  width='232' style=' background-image:url("+link+"/img/email/popup_logo.gif) ; background-repeat:no-repeat; width:232px;'>&nbsp;</td>                                                                                                                                                                                                           \n");
   			contentBase.append("				      <td class='popup_title' style='font-family:dotum; font-size:12px;  text-indent:10px;'>"+subSubject+"</td>                                                                                                                                                                                                           		\n");
   			contentBase.append("				     </tr>                                                                                                                                                                                                                                                      \n");
   			contentBase.append("				    </table>                                                                                                                                                                                                                                                    \n");
   			contentBase.append("				   </td>                                                                                                                                                                                                                                                        \n");
   			contentBase.append("				  </tr>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				  <tr>                                                                                                                                                                                                                                                          \n");
   			contentBase.append("				    <td align='center' style='height:100%; padding:20px; background-image:url("+link+"/img/email/img_h_bg.gif); background-repeat:repeat-y;'>                                                                                                                                  \n");
   			contentBase.append("				     <table width='700' border='0' cellspacing='0' cellpadding='0'>                                                                                                                                                                                             \n");
   			contentBase.append("				        <tr>                                                                                                                                                                                                                                                    \n");
   			contentBase.append("				        <td height='50' align='center'  class='style1' style='color: #3366CC;font-weight: bold;font-size: 24px; border-bottom:#3366CC dotted 2px;'>"+subSubject+"</td>                                                                                                                                                                                       	\n");
   			contentBase.append("				       </tr>                                                                                                                                                                                                                                                    \n");
   			contentBase.append("				      <tr>                                                                                                                                                                                                                                                      \n");
   			contentBase.append("				        <td style='padding:30px 20px 20px 20px;'>                                                                                                                                                                                                               \n");
   			contentBase.append("				         <table width='98%' border='0' cellpadding='0' cellspacing='0' style='border:#CCCCCC dotted 1px;'>                                                                                                                                                      \n");
   			contentBase.append("				                 <tr>                                                                                                                                                                                                                                           \n");
   			contentBase.append("				                    <td height='20' colspan='3' style='line-height:24px; font-size:14px; font-weight:bold; text-align:left; padding:15px;'>"+mailContent+"</td>                                                                                                                                                                                              \n");
   			contentBase.append("				                 </tr>                                                                                                                                                                                                                                          \n");
   			contentBase.append("				                 <tr>                                                                                                                                                                                                                                           \n");
   			contentBase.append("				                    <td height='20' colspan='3'>&nbsp;</td>                                                                                                                                                                                                     \n");
   			contentBase.append("				                 </tr>                                                                                                                                                                                                                                  		\n");
   			contentBase.append("				                 <tr>                                                                                                                                                                                                                                           \n");
   			contentBase.append("				                    <td height='20' colspan='3'>&nbsp;</td>                                                                                                                                                                                                     \n");
   			contentBase.append("				      			</tr>                                                                                                                                                                                                                                                     \n");
   			contentBase.append("				    	</table></td>                                                                                                                                                                                                                                               \n");
   			contentBase.append("				  		</tr>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				  		</table></td>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				  <tr>                                                                                                                                                                                                                                                          \n");
   			contentBase.append("				    <td align=center style='background-image:url("+link+"/img/email/img_h_bg.gif); background-repeat:repeat-y; padding-bottom:20px;'>                                                                                                                                        \n");
   			contentBase.append("				    <table border='0' cellspacing='0' cellpadding='0'>                                                                                                                                                                                                          \n");
   			contentBase.append("				      <tr>                                                                                                                                                                                                                                                      \n");
   			contentBase.append("				        <td><a href='"+linkPortal+"'><img src="+link+"/img/email/btn_go.gif alt='사이트접속하기' border='0'  /></a></td>                                                                                                                                                                  	\n");
   			contentBase.append("				      </tr>                                                                                                                                                                                                                                                     \n");
   			contentBase.append("				    </table></td>                                                                                                                                                                                                                                               \n");
   			contentBase.append("				  </tr>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				   <tr>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				    <td align='center' style='height:50px; vertical-align:top;'>                                                                                                                                                                                                \n");
   			contentBase.append("				    <table border='0' cellspacing='0' cellpadding='0'>                                                                                                                                                                                                          \n");
   			contentBase.append("				      <tr>                                                                                                                                                                                                                                                      \n");
   			contentBase.append("				        <td><img src="+link+"/img/email/img_mail_footter.jpg /></td>                                                                                                                                                                                                         \n");
   			contentBase.append("				      </tr>                                                                                                                                                                                                                                                     \n");
   			contentBase.append("				      <tr>                                                                                                                                                                                                                                                      \n");
   			contentBase.append("				        <td align='center' height='30' style='font-size:11px;'>본메일은 발신전용 메일이므로 회신되지 않습니다.</td>                                                                                                                                             				\n");
   			contentBase.append("				      </tr>                                                                                                                                                                                                                                                     \n");
   			contentBase.append("				                                                                                                                                                                                                                                                                \n");
   			contentBase.append("				    </table></td>                                                                                                                                                                                                                                               \n");
   			contentBase.append("				  </tr>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				 </table>                                                                                                                                                                                                                                                       \n");
   			contentBase.append("				</div>                                                                                                                                                                                                                                                          \n");
   			contentBase.append("				</body>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				</html>																																																															\n");
   		}else{
   			
   			contentBase.append("				<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>																																		\n");
   			contentBase.append("				<html xmlns='http://www.w3.org/1999/xhtml'>                                                                                                                                                                                                                     \n");
   			contentBase.append("				<head>                                                                                                                                                                                                                                                          \n");
   			contentBase.append("				<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />                                                                                                                                                                                          \n");
   			contentBase.append("				<title>:::전자조달_mailing:::</title>                                                                                                                                                                                                                       	\n");
   			contentBase.append("				<style type='text/css'>                                                                                                                                                                                                                                         \n");
   			contentBase.append("				<!--                                                                                                                                                                                                                                                            \n");
   			contentBase.append("				.style1 {color: #3366CC;font-weight: bold;font-size: 24px; border-bottom:#3366CC dotted 2px;}                                                                                                                                                                   \n");
   			contentBase.append("				.popup_table{width:800px; font-family:dotum; font-size:12px; color:#666666; text-align:left;}                                                                                                                                                                   \n");
   			contentBase.append("				.text_red{font-size:12px; color:#cc0000; height:25px; text-align:left; vertical-align:top; text-indent:10px;}                                                                                                                                                   \n");
   			contentBase.append("				.popup_logo{ background-image:url("+link+"/img/email/popup_logo.gif) ; background-repeat:no-repeat; width:232px;}                                                                                                                                                              \n");
   			contentBase.append("				.popup_title{font-family:dotum; font-size:12px;  text-indent:10px;}                                                                                                                                                                                             \n");
   			contentBase.append("				.td_01{ height:28px; background-color:#f5f9fe; line-height:28px; text-indent:20px; border-top:#cccccc solid 1px; border-right:#cccccc solid 1px; width:130px; font-weight:bold; color:#333333;}                                                                 \n");
   			contentBase.append("				.td_01_2{ height:28px; background-color:#f5f9fe; line-height:28px; text-indent:20px; border-top:#cccccc solid 1px; border-right:#cccccc solid 1px;border-bottom:#cccccc solid 1px; width:130px; font-weight:bold; color:#333333;}                               \n");
   			contentBase.append("				.td_02{ height:28px;line-height:28px;border-top:#cccccc solid 1px; text-indent:20px; font-weight:bold; color:#2f63ac;}                                                                                                                                          \n");
   			contentBase.append("				.td_02_2{ height:28px;line-height:28px; text-indent:5px; color:#2f63ac;}                                                                                                                                                                                        \n");
   			contentBase.append("				.td_02_3{ line-height:16px; color:#2f63ac; font-size:11px;}                                                                                                                                                                                                     \n");
   			contentBase.append("				.td_03{ height:300px;line-height:20px;border-top:#cccccc solid 1px; color:#333333; padding:20px;}                                                                                                                                                               \n");
   			contentBase.append("				.td_04{ height:28px;line-height:28px;border-top:#cccccc solid 1px; text-indent:20px; color:#666666;border-bottom:#cccccc solid 1px;}                                                                                                                            \n");
   			contentBase.append("				.text01{width:auto; font-size:12px; line-height:18px; padding:5px; text-align:left;}                                                                                                                                                                            \n");
   			contentBase.append("				.text_icon4{color:#ccc; font-size:12px; line-height:16px; width:15px; font-weight:bold;}                                                                                                                                                                        \n");
   			contentBase.append("				.style2 {                                                                                                                                                                                                                                                       \n");
   			contentBase.append("					font-size: 18px;                                                                                                                                                                                                                                            \n");
   			contentBase.append("					font-weight: bold;                                                                                                                                                                                                                                          \n");
   			contentBase.append("				}                                                                                                                                                                                                                                                               \n");
   			contentBase.append("				.style3 {font-size:12px; color:#3366CC; height:25px; text-align:left; vertical-align:top; text-indent:10px;}                                                                                                                                                    \n");
   			contentBase.append("				.style4 {color: #3366CC;font-weight: bold;font-size: 14px;}                                                                                                                                                                                                     \n");
   			contentBase.append("				</style>                                                                                                                                                                                                                                                        \n");
   			contentBase.append("				</head>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				<body style='padding:0px; margin:0px;'>                                                                                                                                                                                                                         \n");
   			contentBase.append("				<div align='center'>                                                                                                                                                                                                                                            \n");
   			contentBase.append("				 <table border='0' cellpadding='0' cellspacing='0' class='popup_table' style='width:800px; font-family:dotum; font-size:12px; color:#666666; text-align:left;'>                                                                                                                                                                                         \n");
   			contentBase.append("				  <tr>                                                                                                                                                                                                                                                          \n");
   			contentBase.append("				   <td>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				    <table border='0' cellpadding='0' cellspacing='0' style='width:800px; height:62px; background-image:url("+link+"/img/email/img_mail_title2.gif); background-repeat:no-repeat;'>                                                                                             \n");
   			contentBase.append("				     <tr>                                                                                                                                                                                                                                                       \n");
   			contentBase.append("				      <td class='popup_logo'  width='232' style=' background-image:url("+link+"/img/email/popup_logo.gif) ; background-repeat:no-repeat; width:232px;'>&nbsp;</td>                                                                                                                                                                                                           \n");
   			contentBase.append("				      <td class='popup_title' style='font-family:dotum; font-size:12px;  text-indent:10px;'>"+subSubject+"</td>                                                                                                                                                                                                           		\n");
   			contentBase.append("				     </tr>                                                                                                                                                                                                                                                      \n");
   			contentBase.append("				    </table>                                                                                                                                                                                                                                                    \n");
   			contentBase.append("				   </td>                                                                                                                                                                                                                                                        \n");
   			contentBase.append("				  </tr>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				  <tr>                                                                                                                                                                                                                                                          \n");
   			contentBase.append("				    <td align='center' style='height:100%; padding:20px; background-image:url("+link+"/img/email/img_h_bg.gif); background-repeat:repeat-y;'>                                                                                                                                  \n");
   			contentBase.append("				     <table width='700' border='0' cellspacing='0' cellpadding='0'>                                                                                                                                                                                             \n");
   			contentBase.append("				        <tr>                                                                                                                                                                                                                                                    \n");
   			contentBase.append("				        <td height='50' align='center'  class='style1' style='color: #3366CC;font-weight: bold;font-size: 24px; border-bottom:#3366CC dotted 2px;'>"+subSubject+"</td>                                                                                                                                                                                       	\n");
   			contentBase.append("				       </tr>                                                                                                                                                                                                                                                    \n");
   			contentBase.append("				      <tr>                                                                                                                                                                                                                                                      \n");
   			contentBase.append("				        <td style='padding:30px 20px 20px 20px;'>                                                                                                                                                                                                               \n");
   			contentBase.append("				         <table width='98%' border='0' cellpadding='0' cellspacing='0' style='border:#CCCCCC dotted 1px;'>                                                                                                                                                      \n");
   			contentBase.append("				                 <tr>                                                                                                                                                                                                                                           \n");
   			contentBase.append("				                    <td height='20' colspan='3' style='line-height:24px; font-size:14px; font-weight:bold; text-align:left; padding:15px;'>"+mailContent+"</td>                                                                                                                                                                                              \n");
   			contentBase.append("				                 </tr>                                                                                                                                                                                                                                          \n");
   			contentBase.append("				                 <tr>                                                                                                                                                                                                                                           \n");
   			contentBase.append("				                    <td height='20' colspan='3'>&nbsp;</td>                                                                                                                                                                                                     \n");
   			contentBase.append("				                 </tr>                                                                                                                                                                                                                                  		\n");
   			contentBase.append("				                 <tr>                                                                                                                                                                                                                                           \n");
   			contentBase.append("				                    <td height='20' colspan='3'>&nbsp;</td>                                                                                                                                                                                                     \n");
   			contentBase.append("				      			</tr>                                                                                                                                                                                                                                                     \n");
   			contentBase.append("				    	</table></td>                                                                                                                                                                                                                                               \n");
   			contentBase.append("				  		</tr>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				  		</table></td>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				  <tr>                                                                                                                                                                                                                                                          \n");
   			contentBase.append("				    <td align=center style='background-image:url("+link+"/img/email/img_h_bg.gif); background-repeat:repeat-y; padding-bottom:20px;'>                                                                                                                                        \n");
   			contentBase.append("				    <table border='0' cellspacing='0' cellpadding='0'>                                                                                                                                                                                                          \n");
   			contentBase.append("				      <tr>                                                                                                                                                                                                                                                      \n");
   			contentBase.append("				        <td><a href='"+link+"'><img src="+link+"/img/email/btn_go2.gif alt='사이트접속하기' border='0'  /></a></td>                                                                                                                                                                  	\n");
   			contentBase.append("				      </tr>                                                                                                                                                                                                                                                     \n");
   			contentBase.append("				    </table></td>                                                                                                                                                                                                                                               \n");
   			contentBase.append("				  </tr>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				   <tr>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				    <td align='center' style='height:50px; vertical-align:top;'>                                                                                                                                                                                                \n");
   			contentBase.append("				    <table border='0' cellspacing='0' cellpadding='0'>                                                                                                                                                                                                          \n");
   			contentBase.append("				      <tr>                                                                                                                                                                                                                                                      \n");
   			contentBase.append("				        <td><img src="+link+"/img/email/img_mail_footter.jpg /></td>                                                                                                                                                                                                         \n");
   			contentBase.append("				      </tr>                                                                                                                                                                                                                                                     \n");
   			contentBase.append("				      <tr>                                                                                                                                                                                                                                                      \n");
   			contentBase.append("				        <td align='center' height='30' style='font-size:11px;'>본메일은 발신전용 메일이므로 회신되지 않습니다.</td>                                                                                                                                             				\n");
   			contentBase.append("				      </tr>                                                                                                                                                                                                                                                     \n");
   			contentBase.append("				                                                                                                                                                                                                                                                                \n");
   			contentBase.append("				    </table></td>                                                                                                                                                                                                                                               \n");
   			contentBase.append("				  </tr>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				 </table>                                                                                                                                                                                                                                                       \n");
   			contentBase.append("				</div>                                                                                                                                                                                                                                                          \n");
   			contentBase.append("				</body>                                                                                                                                                                                                                                                         \n");
   			contentBase.append("				</html>																																																															\n");
   		}

   		
   		////System.out.println(contentBase);
   		try {
   			
   			Session session = Session.getInstance(properties, auth);				// Properties 객체와 auth(인증)객체로 메일전송 세션 생성
   			MimeMessage msg = new MimeMessage(session);								// 메일 객체를 세션을 통해 생성
   			
   			InternetAddress[] to_address = {new InternetAddress(toEmail)};			// 받는 사람 메일 주소 객체 생성
   		//	msg.setFrom(new InternetAddress(sendUser));							// 보내는 사람 메일주소 설정
   			
   			msg.setFrom(new InternetAddress(sendUser, "SGC이앤씨(주)"));

   			

   			
   			msg.setRecipients(Message.RecipientType.TO, to_address);				// 받는 사람 메일 주소를 메일 객체에 매핑
   			msg.setContent(contentBase.toString(), "text/html; charset=utf-8");					// 메일 내용을 설정하며 메일 형식을 HTML로 지정
   			msg.setSubject(mailSubject,"utf-8");									// 메일 제목 설정
   			msg.setSentDate(new Date());											// 보내는 날짜 설정
   			
   			Transport.send(msg);													// 메일 전송 부분
   			
   		} catch(MessagingException me) {
   			 WAFLogger.error(this.getClass().getName() + " --> sendEmail() : \n" + me.getMessage());
   	         WAFLogger.error(me);
   			 throw me;
   		} catch(Exception e) {
   			WAFLogger.error(this.getClass().getName() + " --> sendEmail() : \n" + e.getMessage());
               WAFLogger.error(e);
               throw e;
   		}
   	}
    
   private RowSet getSmtpInfo() throws Exception{
       
   	Search search = new SearchImpl();
       RowSet rowSet = new RowSetImpl();
       
       StringBuffer sqlstr = new StringBuffer();       
       
       try {
       	sqlstr.append(" SELECT  CHG_CODE01             \n");
       	sqlstr.append("         ,CHG_CODE02            \n");
       	sqlstr.append("         ,CHG_CODE03            \n");
       	sqlstr.append("         ,CHG_CODE04            \n");
       	sqlstr.append("         ,CHG_CODE05            \n");
       	sqlstr.append("         ,CHG_CODE06            \n");
       	sqlstr.append(" FROM    EBID_COM910T A              \n");
       	sqlstr.append("         ,EBID_COM911T B             \n");
       	sqlstr.append(" WHERE   A.BASECD = B.BASECD    \n");
       	sqlstr.append(" AND     A.BASECD = 'EMAIL'     \n");
       	sqlstr.append(" AND     B.DETAILCD = '001'     \n");
       	
           search.setStatement(sqlstr.toString());
           rowSet = search.execute();            
       }
       catch(WAFSQLException se) {
           Logger.err.println("SQL : \n" + se.getStatement());
           Logger.err.println("PARAM : \n" + se.getParameter());
           throw se;
      }
       finally {
           if( rowSet == null ) rowSet = new RowSetImpl();
           return rowSet;
       }
   }
    
	
   
   public RowSet getFileListRowSet(String corpId, String code) throws Exception {
       Search search = new SearchImpl();
       RowSet listRowSet = null;
       StringBuffer sql = new StringBuffer();
       try {

   		sql.append("	SELECT distinct A.DETAILCD,						\n");
   		sql.append(" 		   A.DETAILNM,								\n");
   		sql.append(" 		   A.DETAILSORTNM,							\n");
   		sql.append(" 		   B.ID AS DOC_CD							\n");
   		sql.append("	FROM EBID_COM911T A, PUB0510T B				\n");
   		sql.append("	WHERE A.BASECD = 'OUT_SUPLLIER_FILE'					\n");
   		sql.append("	AND A.DETAILCD = B.ID(+)						\n");
   		sql.append("	AND B.FILE_GB(+) = '"+corpId+"'				\n");
   		sql.append("	ORDER BY A.DETAILCD								\n");
   		
   		System.out.println(sql);
       	
           search.setStatement(sql.toString());
           
           listRowSet = search.execute();
           WAFLogger.debug(sql.toString());
           
          
           
       } catch(Exception e) {
           WAFLogger.error(this.getClass().getName() + " --> getListRowSet() : \n" + e.getMessage());
           WAFLogger.error("SQL : " + search.getStatement());
           WAFLogger.error(e);
           
       } finally {
           if( listRowSet == null ) listRowSet = new RowSetImpl();
          
       }
       
       return listRowSet;
   }
}