/**
 * @(#)file    UserListSaveBiz.java
 * @(#)author  [개발자명]
 * @(#)version 1.0
 * @(#)date    May 4, 2007
 * @(#)since   JDK 1.4.2
 */
package kr.co.udapsoft.ebid.buyer.sycs.security.biz;

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.util.ValueObject;
import com.udapsoft.waf.system.Biz;
import com.udapsoft.waf.system.HandlerStorage;
import com.udapsoft.waf.common.ui.InitCombo;


public class AuthBatchListGetRightBiz extends Biz {

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

	public void doBiz() throws Exception {
		ValueObject vo = getRIGHT();
		storage.addValueObject("VALUEOBJECT", vo);
		storage.setSuccess(true);
	}

	public RowSet getUserRightRowSet350t() {
        
	    Search search = new SearchImpl();
        RowSet rowSet = new RowSetImpl();
        StringBuffer sqlstr = null;
    
        try {
        	sqlstr = new StringBuffer();
        	
        	sqlstr.append(" SELECT  A.RIGHT_ID  RIGHT_ID,      															\n");
        	sqlstr.append(" 		B.DSCR RIGHT_NAME \n");
        	sqlstr.append(" FROM    PUB0350T A, PUB0340T B                 															\n");
        	sqlstr.append(" WHERE   A.ACCT_ID =  '" + params.get("f_acct_id") + "'               						\n");
        	sqlstr.append(" AND  A.RIGHT_ID = B.RIGHT_ID              						\n");
        	
        	search.setStatement(sqlstr.toString());
            rowSet = search.execute();  
            
    }
    catch(WAFSQLException se) {

    	super.doException(se);
        this.storage.setSuccess(false);
        this.storage.setMessage(se.getMessage());
        storage.setDetailMessage(se);
    }
    finally{if(rowSet == null) rowSet = new RowSetImpl();}
    return rowSet;
}
	
	public ValueObject getRIGHT(){
		ValueObject vo = new ValueObject();
		//String RIGHT_ID = "";
		//String RIGHT_NAME = "";
		try{
			RowSet rowSet = getUserRightRowSet350t();
			
			InitCombo initCombo  = new InitCombo();
			initCombo.makeComboData(rowSet,"RIGHT_ID", "RIGHT_NAME");
			vo.set("RIGHT_ID", initCombo.getCode());
			vo.set("RIGHT_NAME", initCombo.getCodeName());
			//if(rowSet != null){
				
			//}else{
			//	vo = null;
			//}
		    storage.addRowSet("userRight350t_rs", rowSet);
		    
		}catch(Exception e){
			e.printStackTrace();
		}finally{}
		return vo;
	}


}
