/*
 * 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.WorksheetViewDao;
import sikd.ikonsol.model.WorksheetView;
import sikd.sikd5.sikd5ejb.session.util.MyBatisConnectionFactory;

/**
 *
 * @author Imam Bhoim
 */
@Stateless
public class WorksheetViewEjbHomeImpl implements WorksheetViewEjbHome {

    private SqlSessionFactory sqlSessionFactory;
    private SqlSession session = null;

    private WorksheetViewDao dao;

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

    @Override
    public List<WorksheetView> findAllByTahunBasProvinsi(int tahun, int idbas, String kdpemda, String kdperiode) {
        return dao.findAllByTahunBasProvinsi(tahun, idbas, kdpemda, kdperiode);
    }

    @Override
    public WorksheetView selectEliminasi(String kdLvl1, String kdLvl2, String kdLvl3,
            String kdLvl4, int idres, String kdperiode, String kdprov, int tahun) {
        return dao.selectEliminasi(kdLvl1, kdLvl2, kdLvl3, kdLvl4, idres, kdperiode, kdprov, tahun);
    }

    @Override
    public WorksheetView selectDK(String kdLvl1, String kdLvl2, String kdLvl3,
            String kdLvl4, int idres, String kdperiode, String kdprov, int tahun) {
        return dao.selectDK(kdLvl1, kdLvl2, kdLvl3, kdLvl4, idres, kdperiode, kdprov, tahun);
    }

    @Override
    public WorksheetView selectEliminasiManual(String kdLvl1, String kdLvl2, String kdLvl3, String kdLvl4, int idres, String kdperiode, String kdprov, int tahun) {
        return dao.selectEliminasiManual(kdLvl1, kdLvl2, kdLvl3, kdLvl4, idres, kdperiode, kdprov, tahun);
    }

    @Override
    public WorksheetView selectDKManual(String kdLvl1, String kdLvl2, String kdLvl3, String kdLvl4, int idres, String kdperiode, String kdprov, int tahun) {
        return dao.selectDKManual(kdLvl1, kdLvl2, kdLvl3, kdLvl4, idres, kdperiode, kdprov, tahun);
    }

}
