package kr.co.kihyun.beans.entity;

import java.sql.ResultSet;
import java.sql.SQLException;
//import java.io.ByteArrayOutputStream;
//import java.io.ByteArrayInputStream;
//import java.util.Arrays;
//
//import java.sql.Blob;
//
//import kr.co.kihyun.beans.entity.MDept;
//import kr.co.kihyun.beans.entity.MUser;
//import kr.co.kihyun.beans.entity.MoumiEntity;
//import kr.co.kihyun.beans.entity.SysAuth;
//import kr.co.kihyun.beans.entity.TotDoc;
//import kr.co.kihyun.beans.entity.TotReport;
//import kr.co.kihyun.beans.entity.TotReportProcess;
//import kr.co.kihyun.beans.entity.TotReportType;
//
//import java.util.ArrayList;
//import java.util.Calendar;
//import java.util.Collections;
import java.util.Date;
//import java.util.HashMap;
//import java.util.HashSet;
//import java.util.List;
//import java.util.Map;
//import java.util.Set;
//import javax.jdo.JDOObjectNotFoundException;
//import javax.jdo.PersistenceManager;
//import javax.jdo.Query;
//import javax.jdo.annotations.IdentityType;
//import javax.jdo.annotations.NullValue;
//import javax.jdo.annotations.PersistenceCapable;
//import javax.jdo.annotations.Persistent;
//import kr.co.kihyun.beans.entity.ecross.IRemotePersistable;
//import kr.co.kihyun.beans.entity.util.QueryImpl;
//import kr.co.kihyun.io.IUploadable;
//import kr.co.kihyun.lang.MString;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import kr.co.kihyun.db.DBManager;


public class AcceptReport  extends DBManager {

   private static final Logger LOG = LoggerFactory.getLogger(AcceptReport.class);


    private ResultSet rs = null;

    private int count = 0;
    private String[] nameList = null;
    private String[] nameUp   = null;
    private String[] nameDept = null;
    private String[] upDeptName = null;
    private String[] upperNm = null;

    private String[] ownerName = null;
    private String[] phone = null;
    private String[] submitDate = null;
    private String[] founDation = null;
    private String upperDept = null;
    private int[] prss = null;
    private int[] downDocId = null;
    private byte[] attachments = null;
    private int tCount;
    private String[] nullNameup = null;

    //새로 추가 문정호
    private int grade = 0;
    private String organ = null;
    private String id = null;
    private String usID = null;
    private String[] execCode = null;
    private Date[] startDate = null;
    private Date[] endDate = null;
    private int[] docId = null;
    private int[] sendCount;
    private int[] moumiacptLimitstrategy = null;

  /*private String[] data = null;
    private String[] totData = null;*/

	/******** 카테고리 전체 리스트 ********/
	public void getGradeQuery(String docID) {
		StringBuilder sql = new StringBuilder(250);
        String strDocid = docID;
		try {

            sql.append("select coalesce(dt.grade,0),dt.id,dt.UPPER_DEPT,dt.ORGAN from MOUMI_DEPT dt, moumi_muser us where us.DEPT_ID = dt.id and us.id = '"+strDocid+"'");
			rs = execQuery(sql);
			if (rs != null) {
				rs.last();
				count = rs.getRow();
				rs.beforeFirst();
			} else {
				return;
			}

			id = new String();
                        upperDept = new String();
			organ = new String();

			for (int i = 0; rs.next(); i++) {
				grade = rs.getInt(1);
				id = rs.getString(2);
                                upperDept = rs.getString(3);
				organ = rs.getString(4);
			}
          //System.out.println("grade 구하는 쿼리:::::"+sql);

		} catch (SQLException sqlEx) {
			LOG.error("\nSQLState - {}\nMySQL Error Code - {}\nmessage - {}\nsql - {}",
					new Object[] { sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getMessage(), sql,docID });
			throw new RuntimeException(sqlEx);
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		} finally {
			//close(rs);
			//execClose();
                      try {
                            if (rs != null)
                                rs.close();
                            } catch (SQLException ex) {
                                //31.오류 상황 대응 부재_CWE-390 Add by YOUNGJUN,CHO
                                ex.printStackTrace();
                                //++++++++++++++++++++++++++++++++++++++++++++++++
                            }
                                //execClose();
                            try {
                            if (pstmt != null)
                                pstmt.close();
                            } catch (SQLException ex) {
                               //31.오류 상황 대응 부재_CWE-390 Add by YOUNGJUN,CHO
                                ex.printStackTrace();
                                //++++++++++++++++++++++++++++++++++++++++++++++++
                            }

                            try {
                                if (con != null)
                                    con.close();
                            } catch (SQLException ex) {
                                //31.오류 상황 대응 부재_CWE-390 Add by YOUNGJUN,CHO
                                ex.printStackTrace();
                                //++++++++++++++++++++++++++++++++++++++++++++++++
                            }
		}
	}

   /******** 카테고리 전체 리스트 ********/
	public void executeQuery(String id,String upperDept,String organ,String findOption,Object filterValue, String usID) {

		StringBuilder sql = new StringBuilder(250);

        try {

             if(filterValue != null && findOption == null){
                sql.append(" select coalesce(dc.exec_code,'&nbsp'),dc.name,dt.name,sp_cm_dec_fu(dc.owner_name)")
                   .append(" ,dc.start_date,dc.end_date,rt.prss,coalesce(rt.DOWN_DOC_ID,0),rt.id,FN_SNDCNT(DC.ID),AC.SUBMIT_LIMIT_CNT ")
                   .append(" from moumi_tot_doc dc,MOUMI_TOT_REPORT rt,moumi_dept dt,MOUMI_ACPT_LIMIT_STRATEGY AC")
                   .append(" where rt.doc_id = dc.id")
                   .append(" and dc.dept_id = dt.id")
                   .append(" and dc.del_type='N'")
                   .append(" and rt.del_type='N'")
                   //.append(" and rt.dept_id in ('"+id+"','"+upperDept+"','"+organ+"')")
                   .append(" and ((rt.dept_id in ('"+id+"','"+upperDept+"','"+organ+"') and rt.user_id is null) or (rt.user_id = ('"+usID+"'))) ")
                   .append(" and rt.prss in (0,1,2,3)")
                   .append(" and dc.end_date >= current date")
                   .append(" and dc.start_date <= current date")
                   .append(" AND DC.ACPT_LIMIT = AC.ID")
                   .append(" AND (AC.SUBMIT_LIMIT_CNT = 0 OR AC.SUBMIT_LIMIT_CNT > FN_SNDCNT(DC.ID))")
                   .append(" order by dc.END_DATE,rt.id asc");
            }else if(filterValue != null && findOption.equals("totDoc.name")){
                sql.append(" select coalesce(dc.exec_code,'&nbsp'),dc.name,dt.name,sp_cm_dec_fu(dc.owner_name)")
                   .append(" ,dc.start_date,dc.end_date,rt.prss,coalesce(rt.DOWN_DOC_ID,0),rt.id,FN_SNDCNT(DC.ID),AC.SUBMIT_LIMIT_CNT ")
                   .append(" from moumi_tot_doc dc,MOUMI_TOT_REPORT rt,moumi_dept dt,MOUMI_ACPT_LIMIT_STRATEGY AC")
                   .append(" where rt.doc_id = dc.id")
                   .append(" and dc.dept_id = dt.id")
                   .append(" and dc.del_type='N'")
                   .append(" and rt.del_type='N'")
                   //.append(" and rt.dept_id in ('"+id+"','"+upperDept+"','"+organ+"')")
                   .append(" and ((rt.dept_id in ('"+id+"','"+upperDept+"','"+organ+"') and rt.user_id is null) or (rt.user_id = ('"+usID+"'))) ")
                   .append(" and rt.prss in (0,1,2,3)")
                   .append(" and dc.end_date >= current date")
                   .append(" and dc.start_date <= current date")
                   .append(" AND DC.ACPT_LIMIT = AC.ID")
                   .append(" AND (AC.SUBMIT_LIMIT_CNT = 0 OR AC.SUBMIT_LIMIT_CNT > FN_SNDCNT(DC.ID))")
                   .append(" and dc.name like '%"+filterValue+"%'")
                   .append(" order by dc.END_DATE,rt.id asc");
            }else if(filterValue != null && findOption.equals("totDoc.executionCode")){
                sql.append(" select coalesce(dc.exec_code,'&nbsp'),dc.name,dt.name,sp_cm_dec_fu(dc.owner_name)")
                   .append(" ,dc.start_date,dc.end_date,rt.prss,coalesce(rt.DOWN_DOC_ID,0),rt.id,FN_SNDCNT(DC.ID),AC.SUBMIT_LIMIT_CNT ")
                   .append(" from moumi_tot_doc dc,MOUMI_TOT_REPORT rt,moumi_dept dt,MOUMI_ACPT_LIMIT_STRATEGY AC")
                   .append(" where rt.doc_id = dc.id")
                   .append(" and dc.dept_id = dt.id")
                   .append(" and dc.del_type='N'")
                   .append(" and rt.del_type='N'")
                   //.append(" and rt.dept_id in ('"+id+"','"+upperDept+"','"+organ+"')")
                   .append(" and ((rt.dept_id in ('"+id+"','"+upperDept+"','"+organ+"') and rt.user_id is null) or (rt.user_id = ('"+usID+"'))) ")
                   .append(" and rt.prss in (0,1,2,3)")
                   .append(" and dc.end_date >= current date")
                   .append(" and dc.start_date <= current date")
                   .append(" AND DC.ACPT_LIMIT = AC.ID")
                   .append(" AND (AC.SUBMIT_LIMIT_CNT = 0 OR AC.SUBMIT_LIMIT_CNT > FN_SNDCNT(DC.ID))")
                   .append(" and dc.exec_code like '%"+filterValue+"%'")
                   .append(" order by dc.END_DATE,rt.id asc");
            }else if(filterValue != null && findOption.equals("totDoc.mUser.name")){
                sql.append(" select coalesce(dc.exec_code,'&nbsp'),dc.name,dt.name,sp_cm_dec_fu(dc.owner_name)")
                   .append(" ,dc.start_date,dc.end_date,rt.prss,coalesce(rt.DOWN_DOC_ID,0),rt.id,FN_SNDCNT(DC.ID),AC.SUBMIT_LIMIT_CNT ")
                   .append(" from moumi_tot_doc dc,MOUMI_TOT_REPORT rt,moumi_dept dt,MOUMI_ACPT_LIMIT_STRATEGY AC")
                   .append(" where rt.doc_id = dc.id")
                   .append(" and dc.dept_id = dt.id")
                   .append(" and dc.del_type='N'")
                   .append(" and rt.del_type='N'")
                   //.append(" and rt.dept_id in ('"+id+"','"+upperDept+"','"+organ+"')")
                   .append(" and ((rt.dept_id in ('"+id+"','"+upperDept+"','"+organ+"') and rt.user_id is null) or (rt.user_id = ('"+usID+"'))) ")
                   .append(" and rt.prss in (0,1,2,3)")
                   .append(" and dc.end_date >= current date")
                   .append(" and dc.start_date <= current date")
                   .append(" AND DC.ACPT_LIMIT = AC.ID")
                   .append(" AND (AC.SUBMIT_LIMIT_CNT = 0 OR AC.SUBMIT_LIMIT_CNT > FN_SNDCNT(DC.ID))")
                   .append(" and sp_cm_dec_fu(dc.owner_name) like '%"+filterValue+"%'")
                   .append(" order by dc.END_DATE,rt.id asc");
            }else{
                sql.append(" select coalesce(dc.exec_code,'&nbsp'),dc.name,dt.name,sp_cm_dec_fu(dc.owner_name)")
                   .append(" ,dc.start_date,dc.end_date,rt.prss,coalesce(rt.DOWN_DOC_ID,0),rt.id,FN_SNDCNT(DC.ID),AC.SUBMIT_LIMIT_CNT ")
                   .append(" from moumi_tot_doc dc,MOUMI_TOT_REPORT rt,moumi_dept dt,MOUMI_ACPT_LIMIT_STRATEGY AC")
                   .append(" where rt.doc_id = dc.id")
                   .append(" and dc.dept_id = dt.id")
                   .append(" and dc.del_type='N'")
                   .append(" and rt.del_type='N'")
                   //.append(" and rt.dept_id in ('"+id+"','"+upperDept+"','"+organ+"')")
                   .append(" and ((rt.dept_id in ('"+id+"','"+upperDept+"','"+organ+"') and rt.user_id is null) or (rt.user_id = ('"+usID+"'))) ")
                   .append(" and rt.prss in (0,1,2,3)")
                   .append(" and dc.end_date >= current date")
                   .append(" and dc.start_date <= current date")
                   .append(" AND DC.ACPT_LIMIT = AC.ID")
                   .append(" AND (AC.SUBMIT_LIMIT_CNT = 0 OR AC.SUBMIT_LIMIT_CNT > FN_SNDCNT(DC.ID))")
                   .append(" order by dc.END_DATE,rt.id asc");
            }

			rs = execQuery(sql);
			if (rs != null) {
				rs.last();
				count = rs.getRow();
				rs.beforeFirst();
			} else {
				return;
			}
			execCode  = new String[count];
			nameList  = new String[count];
			nameUp    = new String[count];
            ownerName = new String[count];
            startDate = new Date[count];
            endDate   = new Date[count];
            prss      = new int[count];
            downDocId = new int[count];
            docId     = new int[count];
            sendCount = new int[count];
            moumiacptLimitstrategy = new int[count];
            tCount     = count;

			for (int i = 0; rs.next(); i++) {
				execCode[i] = rs.getString(1);
				nameList[i] = rs.getString(2);
				nameUp[i] = rs.getString(3);
                ownerName[i] = rs.getString(4);
				startDate[i] = rs.getDate(5);
				endDate[i] = rs.getDate(6);
                prss[i] = rs.getInt(7);
                downDocId[i] =  rs.getInt(8);
                docId[i]     = rs.getInt(9);
                sendCount[i] = rs.getInt(10);
                moumiacptLimitstrategy[i] = rs.getInt(11);
			}
            //System.out.println(sql+"\n find option::::"+findOption+"\n findWord:::"+filterValue);

		} catch (SQLException sqlEx) {
			LOG.error("\nSQLState - {}\nMySQL Error Code - {}\nmessage - {}\nsql - {}",
					new Object[] { sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getMessage() });
			throw new RuntimeException(sqlEx);
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		} finally {
			//close(rs);
                        try {
                            if (rs != null)
                                rs.close();
                        } catch (SQLException ex) {
                            //31.오류 상황 대응 부재_CWE-390 Add by YOUNGJUN,CHO
                            ex.printStackTrace();
                            //++++++++++++++++++++++++++++++++++++++++++++++++
                        }
                                //execClose();
                        try {
                            if (pstmt != null)
                                pstmt.close();
                        } catch (SQLException ex) {
                            //31.오류 상황 대응 부재_CWE-390 Add by YOUNGJUN,CHO
                            ex.printStackTrace();
                            //++++++++++++++++++++++++++++++++++++++++++++++++
                        }

                        try {
                            if (con != null)
                                con.close();
                        } catch (SQLException ex) {
                            //31.오류 상황 대응 부재_CWE-390 Add by YOUNGJUN,CHO
                            ex.printStackTrace();
                            //++++++++++++++++++++++++++++++++++++++++++++++++
                        }
		}
	}

    /******** 카테고리 전체 리스트 ********/
	public void executeQuery2(String id,String findOption,Object filterValue, String usID) {

		StringBuilder sql = new StringBuilder(250);

        try {
               if(filterValue != null && findOption == null){
                sql.append(" select coalesce(dc.exec_code,'&nbsp'),dc.name,dt.name,sp_cm_dec_fu(dc.owner_name)")
                   .append(" ,dc.start_date,dc.end_date,rt.prss,coalesce(rt.DOWN_DOC_ID,0),rt.id,FN_SNDCNT(DC.ID),AC.SUBMIT_LIMIT_CNT ")
                   .append(" from moumi_tot_doc dc,MOUMI_TOT_REPORT rt,moumi_dept dt,MOUMI_ACPT_LIMIT_STRATEGY AC")
                   .append(" where rt.doc_id = dc.id")
                   .append(" and dc.dept_id = dt.id")
                   .append(" and dc.del_type='N'")
                   .append(" and rt.del_type='N'")
                   //.append(" and rt.dept_id in ('"+id+"')")
                   .append(" and ((rt.dept_id in ('"+id+"') and rt.user_id is null) or (rt.user_id = ('"+usID+"'))) ")
                   .append(" and rt.prss in (0,1,2,3)")
                   .append(" and dc.end_date >= current date")
                   .append(" and dc.start_date <= current date")
                   .append(" AND DC.ACPT_LIMIT = AC.ID")
                   .append(" AND (AC.SUBMIT_LIMIT_CNT = 0 OR AC.SUBMIT_LIMIT_CNT > FN_SNDCNT(DC.ID))")
                   .append(" order by dc.END_DATE,rt.id asc");
            }else if(filterValue != null && findOption.equals("totDoc.name")){
                sql.append(" select coalesce(dc.exec_code,'&nbsp'),dc.name,dt.name,sp_cm_dec_fu(dc.owner_name)")
                   .append(" ,dc.start_date,dc.end_date,rt.prss,coalesce(rt.DOWN_DOC_ID,0),rt.id,FN_SNDCNT(DC.ID),AC.SUBMIT_LIMIT_CNT ")
                   .append(" from moumi_tot_doc dc,MOUMI_TOT_REPORT rt,moumi_dept dt,MOUMI_ACPT_LIMIT_STRATEGY AC")
                   .append(" where rt.doc_id = dc.id")
                   .append(" and dc.dept_id = dt.id")
                   .append(" and dc.del_type='N'")
                   .append(" and rt.del_type='N'")
                   //.append(" and rt.dept_id in ('"+id+"')")
                   .append(" and ((rt.dept_id in ('"+id+"') and rt.user_id is null) or (rt.user_id = ('"+usID+"'))) ")
                   .append(" and rt.prss in (0,1,2,3)")
                   .append(" and dc.end_date >= current date")
                   .append(" and dc.start_date <= current date")
                   .append(" AND DC.ACPT_LIMIT = AC.ID")
                   .append(" AND (AC.SUBMIT_LIMIT_CNT = 0 OR AC.SUBMIT_LIMIT_CNT > FN_SNDCNT(DC.ID))")
                   .append(" and dc.name like '%"+filterValue+"%'")
                   .append(" order by dc.END_DATE,rt.id asc");
            }else if(filterValue != null && findOption.equals("totDoc.executionCode")){
                sql.append(" select coalesce(dc.exec_code,'&nbsp'),dc.name,dt.name,sp_cm_dec_fu(dc.owner_name)")
                   .append(" ,dc.start_date,dc.end_date,rt.prss,coalesce(rt.DOWN_DOC_ID,0),rt.id,FN_SNDCNT(DC.ID),AC.SUBMIT_LIMIT_CNT ")
                   .append(" from moumi_tot_doc dc,MOUMI_TOT_REPORT rt,moumi_dept dt,MOUMI_ACPT_LIMIT_STRATEGY AC")
                   .append(" where rt.doc_id = dc.id")
                   .append(" and dc.dept_id = dt.id")
                   .append(" and dc.del_type='N'")
                   .append(" and rt.del_type='N'")
                   //.append(" and rt.dept_id in ('"+id+"')")
                   .append(" and ((rt.dept_id in ('"+id+"') and rt.user_id is null) or (rt.user_id = ('"+usID+"'))) ")
                   .append(" and rt.prss in (0,1,2,3)")
                   .append(" and dc.end_date >= current date")
                   .append(" and dc.start_date <= current date")
                   .append(" AND DC.ACPT_LIMIT = AC.ID")
                   .append(" AND (AC.SUBMIT_LIMIT_CNT = 0 OR AC.SUBMIT_LIMIT_CNT > FN_SNDCNT(DC.ID))")
                   .append(" and dc.exec_code like '%"+filterValue+"%'")
                   .append(" order by dc.END_DATE,rt.id asc");
            }else if(filterValue != null && findOption.equals("totDoc.mUser.name")){
                sql.append(" select coalesce(dc.exec_code,'&nbsp'),dc.name,dt.name,sp_cm_dec_fu(dc.owner_name)")
                   .append(" ,dc.start_date,dc.end_date,rt.prss,coalesce(rt.DOWN_DOC_ID,0),rt.id,FN_SNDCNT(DC.ID),AC.SUBMIT_LIMIT_CNT ")
                   .append(" from moumi_tot_doc dc,MOUMI_TOT_REPORT rt,moumi_dept dt,MOUMI_ACPT_LIMIT_STRATEGY AC")
                   .append(" where rt.doc_id = dc.id")
                   .append(" and dc.dept_id = dt.id")
                   .append(" and dc.del_type='N'")
                   .append(" and rt.del_type='N'")
                   //.append(" and rt.dept_id in ('"+id+"')")
                   .append(" and ((rt.dept_id in ('"+id+"') and rt.user_id is null) or (rt.user_id = ('"+usID+"'))) ")
                   .append(" and rt.prss in (0,1,2,3)")
                   .append(" and dc.end_date >= current date")
                   .append(" and dc.start_date <= current date")
                   .append(" AND DC.ACPT_LIMIT = AC.ID")
                   .append(" AND (AC.SUBMIT_LIMIT_CNT = 0 OR AC.SUBMIT_LIMIT_CNT > FN_SNDCNT(DC.ID))")
                   .append(" and sp_cm_dec_fu(dc.owner_name) like '%"+filterValue+"%'")
                   .append(" order by dc.END_DATE,rt.id asc");
            }else{
                sql.append(" select coalesce(dc.exec_code,'&nbsp'),dc.name,dt.name,sp_cm_dec_fu(dc.owner_name)")
                   .append(" ,dc.start_date,dc.end_date,rt.prss,coalesce(rt.DOWN_DOC_ID,0),rt.id,FN_SNDCNT(DC.ID),AC.SUBMIT_LIMIT_CNT ")
                   .append(" from moumi_tot_doc dc,MOUMI_TOT_REPORT rt,moumi_dept dt,MOUMI_ACPT_LIMIT_STRATEGY AC")
                   .append(" where rt.doc_id = dc.id")
                   .append(" and dc.dept_id = dt.id")
                   .append(" and dc.del_type='N'")
                   .append(" and rt.del_type='N'")
                   //.append(" and rt.dept_id in ('"+id+"')")
                   .append(" and ((rt.dept_id in ('"+id+"') and rt.user_id is null) or (rt.user_id = ('"+usID+"'))) ")
                   .append(" and rt.prss in (0,1,2,3)")
                   .append(" and dc.end_date >= current date")
                   .append(" and dc.start_date <= current date")
                   .append(" AND DC.ACPT_LIMIT = AC.ID")
                   .append(" AND (AC.SUBMIT_LIMIT_CNT = 0 OR AC.SUBMIT_LIMIT_CNT > FN_SNDCNT(DC.ID))")
                   .append(" order by dc.END_DATE,rt.id asc");
            }

			rs = execQuery(sql);
			if (rs != null) {
				rs.last();
				count = rs.getRow();
				rs.beforeFirst();
			} else {
				return;
			}
			execCode  = new String[count];
			nameList  = new String[count];
			nameUp    = new String[count];
            ownerName = new String[count];
            startDate = new Date[count];
            endDate   = new Date[count];
            prss      = new int[count];
            downDocId = new int[count];
            docId     = new int[count];
            sendCount = new int[count];
            moumiacptLimitstrategy = new int[count];
            tCount     = count;

			for (int i = 0; rs.next(); i++) {
				execCode[i] = rs.getString(1);
				nameList[i] = rs.getString(2);
				nameUp[i] = rs.getString(3);
                                ownerName[i] = rs.getString(4);
				startDate[i] = rs.getDate(5);
				endDate[i] = rs.getDate(6);
                                prss[i] = rs.getInt(7);
                downDocId[i] =  rs.getInt(8);
                docId[i]     = rs.getInt(9);
                sendCount[i] = rs.getInt(10);
                moumiacptLimitstrategy[i] = rs.getInt(11);
			}
             //System.out.println(sql+"\n find option::::"+findOption+"\n findWord:::"+filterValue);

		} catch (SQLException sqlEx) {
			LOG.error("\nSQLState - {}\nMySQL Error Code - {}\nmessage - {}\nsql - {}",
					new Object[] { sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getMessage() });
			throw new RuntimeException(sqlEx);
		} catch (Exception ex) {
			throw new RuntimeException(ex);
		} finally {
			//close(rs);
			//execClose();
                    try {
                        if (rs != null)
                            rs.close();
                    } catch (SQLException ex) {
                        //31.오류 상황 대응 부재_CWE-390 Add by YOUNGJUN,CHO
                        ex.printStackTrace();
                        //++++++++++++++++++++++++++++++++++++++++++++++++
                    }
                                //execClose();
                    try {
                        if (pstmt != null)
                            pstmt.close();
                    } catch (SQLException ex) {
                        //31.오류 상황 대응 부재_CWE-390 Add by YOUNGJUN,CHO
                        ex.printStackTrace();
                        //++++++++++++++++++++++++++++++++++++++++++++++++
                    }

                    try {
                        if (con != null)
                            con.close();
                    } catch (SQLException ex) {
                        //31.오류 상황 대응 부재_CWE-390 Add by YOUNGJUN,CHO
                        ex.printStackTrace();
                        //++++++++++++++++++++++++++++++++++++++++++++++++
                    }
		}
	}


    public String[] getNameList() {
            //24.Public 메소드로부터 반환된 Private배열_CWE-495 : Update by KWON,HAN
	    //	return nameList;

            String[] ret = null;
            if( this.nameList != null) {
                ret = new String[nameList.length];
                for (int i=0; i<nameList.length; i++) {
                    ret[i] = this.nameList[i];
                }
            }
            return ret;
            //====================================================================
	}

     public String[] getNameUp() {
	    //	return nameUp;

            String[] ret = null;
            if( this.nameUp != null) {
                ret = new String[nameUp.length];
                for (int i=0; i<nameUp.length; i++) {
                    ret[i] = this.nameUp[i];
                }
            }
            return ret;
	}

       public String[] getUpperNm() {
	    //	return upperNm;

            String[] ret = null;
            if( this.upperNm != null) {
                ret = new String[upperNm.length];
                for (int i=0; i<upperNm.length; i++) {
                    ret[i] = this.upperNm[i];
                }
            }
            return ret;
	}


    public String[] getNameDept() {
	    //	return nameDept;

            String[] ret = null;
            if( this.nameDept != null) {
                ret = new String[nameDept.length];
                for (int i=0; i<nameDept.length; i++) {
                    ret[i] = this.nameDept[i];
                }
            }
            return ret;
	}

    public String[] getOwnerName() {
	    //	return ownerName;

            String[] ret = null;
            if( this.ownerName != null) {
                ret = new String[ownerName.length];
                for (int i=0; i<ownerName.length; i++) {
                    ret[i] = this.ownerName[i];
                }
            }
            return ret;
	}

    public String getId() {
		return id;
	}

    public String[]  getPhone(){
          //return phone;

        String[] ret = null;
        if( this.phone != null) {
            ret = new String[phone.length];
            for (int i=0; i<phone.length; i++) {
                ret[i] = this.phone[i];
            }
        }
        return ret;
      }

    public String[]  getSubmitdate(){
        //  return submitDate;

        String[] ret = null;
        if( this.submitDate != null) {
            ret = new String[submitDate.length];
            for (int i=0; i<submitDate.length; i++) {
                ret[i] = this.submitDate[i];
            }
        }
        return ret;
      }

    public String[]  getFounDation(){
        //  return founDation;

        String[] ret = null;
        if( this.founDation != null) {
            ret = new String[founDation.length];
            for (int i=0; i<founDation.length; i++) {
                ret[i] = this.founDation[i];
            }
        }
        return ret;
      }

     public int[]  getDowndocid(){
        //  return downDocId;

        int[] ret = null;
        if( this.downDocId != null) {
            ret = new int[downDocId.length];
            for (int i=0; i<downDocId.length; i++) {
                ret[i] = this.downDocId[i];
            }
        }
        return ret;
      }


    public int  getGrade(){
          return grade;
      }

   public int[]  getPrss(){
        //  return prss;

        int[] ret = null;
        if( this.prss != null) {
            ret = new int[prss.length];
            for (int i=0; i<prss.length; i++) {
                ret[i] = this.prss[i];
            }
        }
        return ret;
      }

  public String  getOrgan(){
          return organ;
      }

  public String  getUpperDept(){
          return upperDept;
      }


   public byte[]  getAttachments(){
        //  return attachments;

        byte[] ret = null;
        if( this.attachments != null) {
            ret = new byte[attachments.length];
            for (int i=0; i<attachments.length; i++) {
                ret[i] = this.attachments[i];
            }
        }
        return ret;
      }

   public int  getCount(){
          return tCount;
      }

   public String[]  getNullnameup(){
        //  return nullNameup;

        String[] ret = null;
        if( this.nullNameup != null) {
            ret = new String[nullNameup.length];
            for (int i=0; i<nullNameup.length; i++) {
                ret[i] = this.nullNameup[i];
            }
        }
        return ret;
     }

  public String[]  getExeccode(){
        //  return execCode;

        String[] ret = null;
        if( this.execCode != null) {
            ret = new String[execCode.length];
            for (int i=0; i<execCode.length; i++) {
                ret[i] = this.execCode[i];
            }
        }
        return ret;
      }

  public String[]  getUpperName(){
        //  return upDeptName;

        String[] ret = null;
        if( this.upDeptName != null) {
            ret = new String[upDeptName.length];
            for (int i=0; i<upDeptName.length; i++) {
                ret[i] = this.upDeptName[i];
            }
        }
        return ret;
      }

  public Date[]  getStartdate(){
        //  return startDate;

        Date[] ret = null;
        if( this.startDate != null) {
            ret = new Date[startDate.length];
            for (int i=0; i<startDate.length; i++) {
                ret[i] = this.startDate[i];
            }
        }
        return ret;
      }
  public Date[]  getEnddate(){
        //  return endDate;

        Date[] ret = null;
        if( this.endDate != null) {
            ret = new Date[endDate.length];
            for (int i=0; i<endDate.length; i++) {
                ret[i] = this.endDate[i];
            }
        }
        return ret;
      }

   public int[]  getDocid(){
        //  return docId;

        int[] ret = null;
        if( this.docId != null) {
            ret = new int[docId.length];
            for (int i=0; i<docId.length; i++) {
                ret[i] = this.docId[i];
            }
        }
        return ret;
      }

   public int[]  getSendReqCount(){
        //  return sendCount;

        int[] ret = null;
        if( this.sendCount != null) {
            ret = new int[sendCount.length];
            for (int i=0; i<sendCount.length; i++) {
                ret[i] = this.sendCount[i];
            }
        }
        return ret;
      }

   public int[]  getMoumiAcptLimitStrategy(){
        //  return moumiacptLimitstrategy;

        int[] ret = null;
        if( this.moumiacptLimitstrategy != null) {
            ret = new int[moumiacptLimitstrategy.length];
            for (int i=0; i<moumiacptLimitstrategy.length; i++) {
                ret[i] = this.moumiacptLimitstrategy[i];
            }
        }
        return ret;
      }

}
