/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sikd.ikonsol.ejb.session;

import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.Stateless;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import sikd.ikonsol.ejb.dao.AkunEliminasiDao;
import sikd.ikonsol.ejb.dao.MonitoringProvinsiDao;
import sikd.ikonsol.model.MonitoringNasional;
import sikd.ikonsol.model.MonitoringProvinsi;
import sikd.ikonsol.model.MonitoringWilayah;
import sikd.sikd5.sikd5ejb.session.util.MyBatisConnectionFactory;

/**
 *
 * @author Imam Bhoim
 */
@Stateless
public class MonitoringEjbHomeImpl implements MonitoringEjbHome {

    private SqlSessionFactory sqlSessionFactory;
    private SqlSession session = null;

    private MonitoringProvinsiDao dao;

    @PostConstruct
    public void init() {
        try {
            System.out.println("-------- Load MyBatis Factory IKonsol ------- ");
            sqlSessionFactory = MyBatisConnectionFactory.getSqlSessionFactoryIkonsol();
            dao = new MonitoringProvinsiDao(sqlSessionFactory);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    @Override
    public List<MonitoringProvinsi> findByTahunLaporanMP(int tahun, int idlaporan, int idbas, String kdPeriode) {
        return dao.findAllByTahunLaporanMP(tahun, idlaporan, idbas, kdPeriode);
    }

    @Override
    public List<MonitoringProvinsi> findByTahunLaporanMW(int tahun, int idlaporan, int idbas, String kdperiode) {
        return dao.findAllByTahunLaporanMW(tahun, idlaporan, idbas, kdperiode);
    }

    @Override
    public List<MonitoringProvinsi> findByTahun(int tahun, int idbas, String kdperiode) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

}
