/**
 * @(#)file    OwnListBiz.java
 * @(#)author  gyeongmo an
 * @(#)date    2014.7.2
 * Copyright (c) www.udapsoft.co.kr, Inc.
 */
package kr.co.udapsoft.ebid.buyer.sycs.own.biz;

import kr.co.hsnc.common.base.WAFLogger;
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.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 com.udapsoft.waf.system.Biz;
import com.udapsoft.waf.system.HandlerStorage;


public class OwnListBiz extends Biz {

	public OwnListBiz(HandlerStorage storage) {
		super(storage);
	}
	
	public void doBiz() throws Exception {
		if(storage.compareEvent("")){
			ValueObject vo = getOwnList();
	        storage.addValueObject("ownListRowSet", vo);
		}
	}

	
	private ValueObject getOwnList() {
        Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sql = new StringBuffer();
        ValueObject vo = new ValueObject();
        try {
        	sql.append(" SELECT               	\n");
        	sql.append("     CORP_REG_NO      	\n");
        	sql.append("     , CORP_KOR       	\n");
        	sql.append("     , CORP_ENG       	\n");
        	sql.append("     , POST_NO			\n");
        	sql.append("     , ADDRESS        	\n");
        	sql.append("     , CORP_STS       	\n");
        	sql.append("     , BIZ_FORM       	\n");
        	sql.append("     , REP_NAME       	\n");
        	sql.append("     , CORP_TEL       	\n");
        	sql.append("     , CRE_BY         	\n");
        	sql.append("     , CRE_DATE       	\n");
        	sql.append("     , UPD_BY         	\n");
        	sql.append("     , UPD_DATE       	\n");
        	sql.append("     , COPR_NO       	\n");
        	sql.append(" FROM HEAD_OFFICE_INFO	\n");
        	
        	search.setStatement(sql);
        	WAFLogger.debug(sql.toString());
            rowSet = search.execute();
            if(rowSet.size()>0){
                vo = RowSetUtility.getValueObject(rowSet.getRow(0));
            }
            return vo;
        }
        catch (WAFSQLException se) {
            super.doException(se);
            this.storage.setSuccess(false);
            this.storage.setMessage(se.getMessage());
            storage.setDetailMessage(se);
        }
        finally{
            if( vo == null) vo = new ValueObject();
            return vo;
        }
	}
	
}