/***********************************************************************************
 * @@ Program Name : HttpDeptList.java Description : 기관에속한 부서들의 목록 Author : 강원중 Create Date : 2003-12-16 History :
 * @@
 ***********************************************************************************/

package kr.co.kihyun.beans.user;

//import java.io.IOException;
//import java.io.PrintWriter;
import java.sql.ResultSet;
import java.sql.SQLException;
//import java.util.ArrayList;
import java.util.Date;
import java.util.List;
//import javax.jdo.JDOObjectNotFoundException;
//import javax.jdo.PersistenceManager;
//import javax.jdo.Transaction;
//
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServlet;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import kr.co.kihyun.beans.entity.MDept;
//import kr.co.kihyun.beans.entity.MUser;
//import kr.co.kihyun.beans.entity.UserPart;
//import kr.co.kihyun.beans.entity.util.MPersistenceManager;
//import kr.co.kihyun.beans.entity.util.PMF;
//import kr.co.kihyun.beans.totsys.report.Report;
import kr.co.kihyun.db.DBManager;

//import kr.co.kihyun.lang.Encoder;
//import kr.co.kihyun.moumi.MoumiConfig;
//import kr.co.kihyun.lang.MString;
//import kr.co.kihyun.text.html.ServletUtil;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ApproveGet extends DBManager {

    private  List<String> recogid;
    private ResultSet rs = null;
   	private static final Logger LOG = LoggerFactory.getLogger(ApproveGet.class);

   	private String[] DOCNAME = null;
   	private String[] DEPTNAME = null;
   	private String[] MANAGER = null;
   	private String[] REPORTER = null;
   	private String[] USERID = null;
   	private Date[] STARTDATE = null;
    private Date[] ENDDATE = null;
    private String[] ID = null;
    private String[] REPORTID = null;
    private String[] CURRENTREPOADMID = null;
    private String[] OWNERNAME = null;
    private String[] RECOG = null;
    private String[] PRSS = null;

    // 47.변수 이름 생성규칙 위반 : Update by YOUNGJUN,CHO
    //private String READYCNT = null;
    private String readyCnt = null;
    //private String COMPLETECNT = null;
    private String completeCnt = null;
    //================================================

    private int tCount;

   /******** tmpName 구해오기 ********/
    public void getApproveList(String usID,int gubun,String findOption,Object filterValue) {
        StringBuilder sql = new StringBuilder(250);
        int count = 0;

        try {

            if(filterValue != null && findOption.equals("docName")){
                sql.append(" SELECT  C.NAME,D.NAME,E.NAME,E.ID,F.NAME,B.USER_ID,C.START_DATE,C.END_DATE,A.REPORT_ID,B.CURRENT_REPOADM_ID,C.OWNER_NAME,A.RECOG,B.PRSS ")
                   .append(" FROM MOUMI_REPOADM A,MOUMI_TOT_REPORT B,MOUMI_TOT_DOC C,MOUMI_DEPT D,MOUMI_MUSER E,MOUMI_MUSER F ")
                   .append(" WHERE A.REPORT_ID = B.ID AND B.DOC_ID = C.ID AND C.DEPT_ID = D.ID AND C.USER_ID = E.ID  AND B.USER_ID = F.ID ")
                   .append(" AND C.NAME = '"+filterValue+"'")
                   .append(" AND A.RECOG_USER_ID = '"+usID+"'  AND A.ID = B.CURRENT_REPOADM_ID  AND A.RECOG = "+gubun+"  ORDER BY A.ID DESC ");

            }else if(filterValue != null && findOption.equals("deptName")){
                sql.append(" SELECT  C.NAME,D.NAME,E.NAME,E.ID,F.NAME,B.USER_ID,C.START_DATE,C.END_DATE,A.REPORT_ID,B.CURRENT_REPOADM_ID,C.OWNER_NAME,A.RECOG,B.PRSS ")
                   .append(" FROM MOUMI_REPOADM A,MOUMI_TOT_REPORT B,MOUMI_TOT_DOC C,MOUMI_DEPT D,MOUMI_MUSER E,MOUMI_MUSER F ")
                   .append(" WHERE A.REPORT_ID = B.ID AND B.DOC_ID = C.ID AND C.DEPT_ID = D.ID AND C.USER_ID = E.ID  AND B.USER_ID = F.ID ")
                   .append(" AND D.NAME = '"+filterValue+"'")
                   .append(" AND A.RECOG_USER_ID = '"+usID+"'  AND A.ID = B.CURRENT_REPOADM_ID  AND A.RECOG = "+gubun+"  ORDER BY A.ID DESC ");

            }else if(filterValue != null && findOption.equals("requester")){
                sql.append(" SELECT  C.NAME,D.NAME,E.NAME,E.ID,F.NAME,B.USER_ID,C.START_DATE,C.END_DATE,A.REPORT_ID,B.CURRENT_REPOADM_ID,C.OWNER_NAME,A.RECOG,B.PRSS ")
                   .append(" FROM MOUMI_REPOADM A,MOUMI_TOT_REPORT B,MOUMI_TOT_DOC C,MOUMI_DEPT D,MOUMI_MUSER E,MOUMI_MUSER F ")
                   .append(" WHERE A.REPORT_ID = B.ID AND B.DOC_ID = C.ID AND C.DEPT_ID = D.ID AND C.USER_ID = E.ID  AND B.USER_ID = F.ID ")
                   .append(" AND E.NAME = '"+filterValue+"'")
                   .append(" AND A.RECOG_USER_ID = '"+usID+"'  AND A.ID = B.CURRENT_REPOADM_ID  AND A.RECOG = "+gubun+"  ORDER BY A.ID DESC ");

            }else if(filterValue != null && findOption.equals("reporter")){
                sql.append(" SELECT  C.NAME,D.NAME,E.NAME,E.ID,F.NAME,B.USER_ID,C.START_DATE,C.END_DATE,A.REPORT_ID,B.CURRENT_REPOADM_ID,C.OWNER_NAME,A.RECOG,B.PRSS ")
                   .append(" FROM MOUMI_REPOADM A,MOUMI_TOT_REPORT B,MOUMI_TOT_DOC C,MOUMI_DEPT D,MOUMI_MUSER E,MOUMI_MUSER F ")
                   .append(" WHERE A.REPORT_ID = B.ID AND B.DOC_ID = C.ID AND C.DEPT_ID = D.ID AND C.USER_ID = E.ID  AND B.USER_ID = F.ID ")
                   .append(" AND F.NAME = '"+filterValue+"'")
                   .append(" AND A.RECOG_USER_ID = '"+usID+"'  AND A.ID = B.CURRENT_REPOADM_ID  AND A.RECOG = "+gubun+"  ORDER BY A.ID DESC ");

            }else{
                sql.append(" SELECT  C.NAME,D.NAME,E.NAME,E.ID,F.NAME,B.USER_ID,C.START_DATE,C.END_DATE,A.REPORT_ID,B.CURRENT_REPOADM_ID,C.OWNER_NAME,A.RECOG,B.PRSS ")
                   .append(" FROM MOUMI_REPOADM A,MOUMI_TOT_REPORT B,MOUMI_TOT_DOC C,MOUMI_DEPT D,MOUMI_MUSER E,MOUMI_MUSER F ")
                   .append(" WHERE A.REPORT_ID = B.ID AND B.DOC_ID = C.ID AND C.DEPT_ID = D.ID AND C.USER_ID = E.ID  AND B.USER_ID = F.ID ")
                   .append(" AND A.RECOG_USER_ID = '"+usID+"'  AND A.ID = B.CURRENT_REPOADM_ID  AND A.RECOG = "+gubun+"  ORDER BY A.ID DESC ");
            }

            //System.out.println("getApproveList::::::"+sql);

            rs = execQuery(sql);
            if (rs != null) {
                rs.last();
                count = rs.getRow();
                rs.beforeFirst();
            } else {
                return;
            }

            DOCNAME  = new String[count];
            DEPTNAME  = new String[count];
            MANAGER  = new String[count];
            ID       = new String[count];
            REPORTER = new String[count];
            USERID   = new String[count];
            STARTDATE= new Date[count];
            ENDDATE  = new Date[count];
            REPORTID = new String[count];
            CURRENTREPOADMID = new String[count];
            OWNERNAME = new String[count];
            RECOG = new String[count];
            PRSS = new String[count];
            tCount   = count;

            for (int i = 0; rs.next(); i++) {
                DOCNAME[i]   = rs.getString(1);
                DEPTNAME[i]   = rs.getString(2);
                MANAGER[i]   = rs.getString(3);
                ID[i]        = rs.getString(4);
                REPORTER[i]  = rs.getString(5);
                USERID[i]    = rs.getString(6);
                STARTDATE[i] = rs.getDate(7);
                ENDDATE[i]   = rs.getDate(8);
                REPORTID[i]  = rs.getString(9);
                CURRENTREPOADMID[i] = rs.getString(10);
                OWNERNAME[i] = rs.getString(11);
                RECOG[i] = rs.getString(12);
                PRSS[i] = rs.getString(13);
            }

            //System.out.println(sql);

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


    /******** tmpName 구해오기 ********/
    public void getAppCompleteList(String usID,int gubun1,int gubun2,String findOption,Object filterValue) {
        StringBuilder sql = new StringBuilder(250);
        int count = 0;

        try {

            if(filterValue != null && findOption.equals("docName")){
                sql.append(" SELECT  C.NAME,D.NAME,E.NAME,E.ID,F.NAME,B.USER_ID,C.START_DATE,C.END_DATE,A.REPORT_ID,B.CURRENT_REPOADM_ID,C.OWNER_NAME,A.RECOG,B.PRSS ")
                   .append(" FROM MOUMI_REPOADM A,MOUMI_TOT_REPORT B,MOUMI_TOT_DOC C,MOUMI_DEPT D,MOUMI_MUSER E,MOUMI_MUSER F ")
                   .append(" WHERE A.REPORT_ID = B.ID AND B.DOC_ID = C.ID AND C.DEPT_ID = D.ID AND C.USER_ID = E.ID  AND B.USER_ID = F.ID ")
                   .append(" AND C.NAME = '"+filterValue+"'")
                   //.append(" AND A.RECOG_USER_ID = '"+usID+"' AND ((A.ID)+1 = B.CURRENT_REPOADM_ID  OR A.ID = B.CURRENT_REPOADM_ID )  AND (A.RECOG = "+gubun1+" OR A.RECOG = "+gubun2+")  ORDER BY A.ID DESC ");
                   .append(" AND A.RECOG_USER_ID = '"+usID+"'AND (A.RECOG = "+gubun1+" OR A.RECOG = "+gubun2+")  ORDER BY A.ID DESC ");

            }else if(filterValue != null && findOption.equals("deptName")){
                sql.append(" SELECT  C.NAME,D.NAME,E.NAME,E.ID,F.NAME,B.USER_ID,C.START_DATE,C.END_DATE,A.REPORT_ID,B.CURRENT_REPOADM_ID,C.OWNER_NAME,A.RECOG,B.PRSS ")
                   .append(" FROM MOUMI_REPOADM A,MOUMI_TOT_REPORT B,MOUMI_TOT_DOC C,MOUMI_DEPT D,MOUMI_MUSER E,MOUMI_MUSER F ")
                   .append(" WHERE A.REPORT_ID = B.ID AND B.DOC_ID = C.ID AND C.DEPT_ID = D.ID AND C.USER_ID = E.ID  AND B.USER_ID = F.ID ")
                   .append(" AND D.NAME = '"+filterValue+"'")
                   //.append(" AND A.RECOG_USER_ID = '"+usID+"' AND ((A.ID)+1 = B.CURRENT_REPOADM_ID  OR A.ID = B.CURRENT_REPOADM_ID ) AND (A.RECOG = "+gubun1+" OR A.RECOG = "+gubun2+")  ORDER BY A.ID DESC ");
                    .append(" AND A.RECOG_USER_ID = '"+usID+"'AND (A.RECOG = "+gubun1+" OR A.RECOG = "+gubun2+")  ORDER BY A.ID DESC ");

            }else if(filterValue != null && findOption.equals("requester")){
                sql.append(" SELECT  C.NAME,D.NAME,E.NAME,E.ID,F.NAME,B.USER_ID,C.START_DATE,C.END_DATE,A.REPORT_ID,B.CURRENT_REPOADM_ID,C.OWNER_NAME,A.RECOG,B.PRSS ")
                   .append(" FROM MOUMI_REPOADM A,MOUMI_TOT_REPORT B,MOUMI_TOT_DOC C,MOUMI_DEPT D,MOUMI_MUSER E,MOUMI_MUSER F ")
                   .append(" WHERE A.REPORT_ID = B.ID AND B.DOC_ID = C.ID AND C.DEPT_ID = D.ID AND C.USER_ID = E.ID  AND B.USER_ID = F.ID ")
                   .append(" AND E.NAME = '"+filterValue+"'")
                   //.append("  AND A.RECOG_USER_ID = '"+usID+"'  AND ((A.ID)+1 = B.CURRENT_REPOADM_ID  OR A.ID = B.CURRENT_REPOADM_ID )  AND (A.RECOG = "+gubun1+" OR A.RECOG = "+gubun2+")  ORDER BY A.ID DESC ");
                    .append(" AND A.RECOG_USER_ID = '"+usID+"'AND (A.RECOG = "+gubun1+" OR A.RECOG = "+gubun2+")  ORDER BY A.ID DESC ");

            }else if(filterValue != null && findOption.equals("reporter")){
                sql.append(" SELECT  C.NAME,D.NAME,E.NAME,E.ID,F.NAME,B.USER_ID,C.START_DATE,C.END_DATE,A.REPORT_ID,B.CURRENT_REPOADM_ID,C.OWNER_NAME,A.RECOG,B.PRSS ")
                   .append(" FROM MOUMI_REPOADM A,MOUMI_TOT_REPORT B,MOUMI_TOT_DOC C,MOUMI_DEPT D,MOUMI_MUSER E,MOUMI_MUSER F ")
                   .append(" WHERE A.REPORT_ID = B.ID AND B.DOC_ID = C.ID AND C.DEPT_ID = D.ID AND C.USER_ID = E.ID  AND B.USER_ID = F.ID ")
                   .append(" AND F.NAME = '"+filterValue+"'")
                   //.append(" AND A.RECOG_USER_ID = '"+usID+"' AND ((A.ID)+1 = B.CURRENT_REPOADM_ID  OR A.ID = B.CURRENT_REPOADM_ID )  AND (A.RECOG = "+gubun1+" OR A.RECOG = "+gubun2+")  ORDER BY A.ID DESC ");
                    .append(" AND A.RECOG_USER_ID = '"+usID+"'AND (A.RECOG = "+gubun1+" OR A.RECOG = "+gubun2+")  ORDER BY A.ID DESC ");

            }else{
                sql.append(" SELECT  C.NAME,D.NAME,E.NAME,E.ID,F.NAME,B.USER_ID,C.START_DATE,C.END_DATE,A.REPORT_ID,B.CURRENT_REPOADM_ID,C.OWNER_NAME,A.RECOG,B.PRSS ")
                   .append(" FROM MOUMI_REPOADM A,MOUMI_TOT_REPORT B,MOUMI_TOT_DOC C,MOUMI_DEPT D,MOUMI_MUSER E,MOUMI_MUSER F ")
                   .append(" WHERE A.REPORT_ID = B.ID AND B.DOC_ID = C.ID AND C.DEPT_ID = D.ID AND C.USER_ID = E.ID  AND B.USER_ID = F.ID ")
                   //.append(" AND A.RECOG_USER_ID = '"+usID+"'  AND ((A.ID)+1 = B.CURRENT_REPOADM_ID  OR A.ID = B.CURRENT_REPOADM_ID )  AND (A.RECOG = "+gubun1+" OR A.RECOG = "+gubun2+")  ORDER BY A.ID DESC ");
                    .append(" AND A.RECOG_USER_ID = '"+usID+"'AND (A.RECOG = "+gubun1+" OR A.RECOG = "+gubun2+")  ORDER BY A.ID DESC ");
            }

           //System.out.println("getAppCompleteList::::::"+sql);

            rs = execQuery(sql);
            if (rs != null) {
                rs.last();
                count = rs.getRow();
                rs.beforeFirst();
            } else {
                return;
            }

            DOCNAME  = new String[count];
            DEPTNAME  = new String[count];
            MANAGER  = new String[count];
            ID       = new String[count];
            REPORTER = new String[count];
            USERID   = new String[count];
            STARTDATE= new Date[count];
            ENDDATE  = new Date[count];
            REPORTID = new String[count];
            CURRENTREPOADMID = new String[count];
            OWNERNAME = new String[count];
            RECOG = new String[count];
            PRSS = new String[count];
            tCount   = count;

            for (int i = 0; rs.next(); i++) {
                DOCNAME[i]   = rs.getString(1);
                DEPTNAME[i]   = rs.getString(2);
                MANAGER[i]   = rs.getString(3);
                ID[i]        = rs.getString(4);
                REPORTER[i]  = rs.getString(5);
                USERID[i]    = rs.getString(6);
                STARTDATE[i] = rs.getDate(7);
                ENDDATE[i]   = rs.getDate(8);
                REPORTID[i]  = rs.getString(9);
                CURRENTREPOADMID[i] = rs.getString(10);
                OWNERNAME[i] = rs.getString(11);
                RECOG[i] = rs.getString(12);
                PRSS[i] = rs.getString(13);
            }

           //System.out.println(sql);

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


    /******** tmpName 구해오기 ********/
    public void getApproveReadyCnt(String usID) {
        StringBuilder sql = new StringBuilder(250);
        int count = 0;

        try {
            sql.append(" SELECT  COUNT(A.RECOG) CNT ")
                .append(" FROM MOUMI_REPOADM A")
                .append(" ,MOUMI_TOT_REPORT B ")
                .append(" ,MOUMI_TOT_DOC C")
                .append(" ,MOUMI_DEPT D")
                .append(" ,MOUMI_MUSER E")
                .append(" ,MOUMI_MUSER F  ")
                .append(" WHERE ")
                .append(" A.REPORT_ID = B.ID ")
                .append(" AND B.DOC_ID = C.ID ")
                .append(" AND C.DEPT_ID = D.ID ")
                .append(" AND C.USER_ID = E.ID ")
                .append(" AND B.USER_ID = F.ID  ")
                .append(" AND B.CURRENT_REPOADM_ID = A.ID")
                .append(" AND A.RECOG_USER_ID = ?  ")
                .append(" AND (A.RECOG = 1)  ORDER BY A.ID DESC");

            //System.out.println("getApproveReadyCnt::::::"+sql);

            rs = execQuery(sql,usID);

            if (rs != null) {
                rs.last();
                count = rs.getRow();
                rs.beforeFirst();
            } else {
                return;
            }

            // 47.변수 이름 생성규칙 위반 : Update by YOUNGJUN,CHO
            //READYCNT  = new String();
            readyCnt = new String();
            //================================================

            tCount = count;

            for (int i = 0; rs.next(); i++) {
                // 47.변수 이름 생성규칙 위반 : Update by YOUNGJUN,CHO
                //READYCNT  = rs.getString(1);
                readyCnt = rs.getString(1);
                //================================================
            }

            //System.out.println(sql);

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

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

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


    /******** tmpName 구해오기 ********/
    public void getApproveCompleteCnt(String usID) {
        StringBuilder sql = new StringBuilder(250);
        int count = 0;

        try {

            sql.append("SELECT  COUNT(A.RECOG) CNT ")
                .append(" FROM MOUMI_REPOADM A")
                .append(" ,MOUMI_TOT_REPORT B ")
                .append(" ,MOUMI_TOT_DOC C")
                .append(" ,MOUMI_DEPT D")
                .append(" ,MOUMI_MUSER E")
                .append(" ,MOUMI_MUSER F  ")
                .append(" WHERE ")
                .append(" A.REPORT_ID = B.ID ")
                .append(" AND B.DOC_ID = C.ID ")
                .append(" AND C.DEPT_ID = D.ID ")
                .append(" AND C.USER_ID = E.ID ")
                .append(" AND B.USER_ID = F.ID  ")
                //.append(" AND B.CURRENT_REPOADM_ID = A.ID")
                .append(" AND A.RECOG_USER_ID = ?  ")
                .append(" AND (A.RECOG = 2)  ORDER BY A.ID DESC");
            //System.out.println("getApproveCompleteCnt::::::"+sql);

            rs = execQuery(sql,usID);

            if (rs != null) {
                rs.last();
                count = rs.getRow();
                rs.beforeFirst();
            } else {
                return;
            }

            // 47.변수 이름 생성규칙 위반 : Update by YOUNGJUN,CHO
            //COMPLETECNT  = new String();
            completeCnt = new String();
            //================================================

            tCount   = count;

            for (int i = 0; rs.next(); i++) {
                // 47.변수 이름 생성규칙 위반 : Update by YOUNGJUN,CHO
                //COMPLETECNT   = rs.getString(1);
                completeCnt = rs.getString(1);
                //================================================
            }

            //System.out.println(sql);

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


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

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

    public String[] getDeptName() {
        //return DEPTNAME;

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

    public String[] getManager() {
        //return MANAGER;

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

    public String[] getReporter() {
        //return REPORTER;

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

    public String[] getUserId() {
        //return USERID;

        String[] ret = null;
        if( this.USERID != null) {
            ret = new String[USERID.length];
            for (int i=0; i<USERID.length; i++) {
                ret[i] = this.USERID[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 String[] getID() {
        //return ID;

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

    public String[] getReportId() {
        //return REPORTID;

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

    public String[] getCurrentRepoAdm() {
        //return CURRENTREPOADMID;

        String[] ret = null;
        if( this.CURRENTREPOADMID != null) {
            ret = new String[CURRENTREPOADMID.length];
            for (int i=0; i<CURRENTREPOADMID.length; i++) {
                ret[i] = this.CURRENTREPOADMID[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[] getRecog() {
        //return RECOG;

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

    public String[] getPrss() {
        //return PRSS;

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

    public String getReady() {
        // 47.변수 이름 생성규칙 위반 : Update by YOUNGJUN,CHO
        //return READYCNT;
        return readyCnt;
        //================================================
    }

    public String getComplete() {
        // 47.변수 이름 생성규칙 위반 : Update by YOUNGJUN,CHO
        //return COMPLETECNT;
        return completeCnt;
        //================================================
    }

    public int getTcount(){
        return tCount;
    }

}
