
<%@page import="kr.co.kihyun.beans.entity.ecross.IRemotePersistable"%>
<%@page import="kr.co.kihyun.beans.ecross.VCMCCMC2013"%>
<%@page import="kr.co.kihyun.beans.ecross.ECrossInterface"%>
<%@page import="kr.co.kihyun.beans.entity.MDept"%>
<%
    /***********************************************************
     * @@ Program Name : irData_insert.jsp
     * @@ Description : 시도 DB IR 테이블의 교육부 자료 조회후 시도 DB 업무 테이블에 INSERT
     * @@ Author : Administrator
     * @@ Create Date : 2016. 4. 15
     * @@ History : 
     * @@*******************************************************
     */
%>
<%@ page contentType="text/html; charset=UTF-8"
         import="java.net.URLEncoder"
         import="java.net.URLDecoder"           
         import="java.util.List" 
         import="java.util.Map"
         import="java.util.HashMap"
         import="java.util.Date"
         import="java.util.Calendar"
         import="java.text.SimpleDateFormat"
         import="javax.jdo.PersistenceManager"
         import="javax.jdo.Transaction"
         import="kr.co.kihyun.beans.user.HttpSSOLogin"
         import="kr.co.kihyun.lang.Encoder"
         import="kr.co.kihyun.lang.MInteger"
         import="kr.co.kihyun.lang.MString"
         import="kr.co.kihyun.moumi.MoumiConfig"         
         import="kr.co.kihyun.moumi.Moumi"
         import="kr.co.kihyun.beans.entity.util.*"
         import="kr.co.kihyun.text.html.ServletUtil"
         import="org.slf4j.Logger"         
         import="org.slf4j.LoggerFactory"
         import="kr.co.kihyun.service.TotDocService" 
         import="kr.co.kihyun.service.vo.TotDocVO"%>
<%@ include file="/totsys/common/inc/sec/secure.inc.jsp"%>
<%

    MPersistenceManager pm = new MPersistenceManager(PMF.get().getPersistenceManager());
    MPersistenceManager eCrossPm = new MPersistenceManager(PMF.get("ECROSS").getPersistenceManager());
    Transaction tx = pm.currentTransaction();
    Transaction eCrossTx = eCrossPm.currentTransaction();
    
    try {
        Logger LOG = LoggerFactory.getLogger(this.getClass());

        try{


        /***  교육부 데이타 조회 기능 ***/

            eCrossTx.begin();
            tx.begin();
            ECrossInterface eInterface = new VCMCCMC2013((MDept) null);

            List<? extends IRemotePersistable> receivedList = eInterface.loadAll(pm, eCrossPm);
               
            tx.commit();
            eCrossTx.commit();
        
            out.println(ServletUtil.alert("교육부에서 요청한 자료가 조회 되었습니다"));
            
        } catch (Exception ex) {
            ex.printStackTrace();
            LOG.error("교육부 자료 조회" + MoumiConfig.getMessageBundle().getString("moumi.message.tot_doc.fail"));
            out.println(ServletUtil.alert("교육부 자료 조회를 실패 하였습니다"));
        } finally {
            if (tx.isActive()) tx.rollback();
            if (eCrossTx.isActive()) eCrossTx.rollback();
            eCrossPm.close();
	}         
         
        out.println(ServletUtil.getJavaScript("parent.fn_indiClose();"));
         
        //*/ 
%>
<%
    } catch (Exception ex) {
        ex.printStackTrace();
        out.println(kr.co.kihyun.text.html.ServletUtil.getJavaScript("location='/servlet/kr.co.kihyun.beans.user.HttpSSOLogin?mode=logout';"));
    } finally {
        if (tx.isActive()) {
            tx.rollback();
        }
        pm.close();
    }
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1></h1>
    </body>
</html>
