/**
 * @(#)file    FileListBiz.java
 * @(#)author  chj
 * @(#)version 1.0
 * @(#)date    2014-06-24
 * @(#)since   JDK1.6
 *
 * Copyright (c) www.udapsoft.co.kr, Inc.
 */
package kr.co.udapsoft.ebid.buyer.common.file.biz;

import kr.co.hsnc.common.sql.Row;
import kr.co.hsnc.common.sql.RowSet;
import kr.co.hsnc.common.util.ValueObject;
import kr.co.udapsoft.ebid.buyer.common.file.FileManager;
import com.udapsoft.waf.system.Biz;
import com.udapsoft.waf.system.HandlerStorage;

/**
 * 첨부파일 목록 조회
 * 
 */
public class FileListInfoStrBiz extends Biz {

	public FileListInfoStrBiz(HandlerStorage storage) {

		super(storage);
	}

	/** 
     * 첨부파일 목록을 리턴한다.
	 */
	public void doBiz() throws Exception {

        String fileGB = params.get("file_gb");
        String ID     = params.get("id");

        RowSet rowSet = FileManager.getFileList(fileGB, ID);

        ValueObject vo = new ValueObject();

        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 +="\n";
        	}
        }
        
        vo.set("FILE_INFO", str);
        storage.addValueObject("VALUEOBJECT", vo);
	}
}
