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

/**
 *
 * @author Imam Bhoim
 */
@Stateless
public class InformasiEjbHomeImpl implements InformasiEjbHome {
    
    private SqlSessionFactory sqlSessionFactory;
    private SqlSession session = null;
    
    private InformasiDao dao;
    
    @PostConstruct
    public void init() {
        try {
            System.out.println("-------- Load MyBatis Factory IKonsol ------- ");
            sqlSessionFactory = MyBatisConnectionFactory.getSqlSessionFactoryIkonsol();
            dao = new InformasiDao(sqlSessionFactory);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    
    @Override
    public List<Informasi> findAllInfoApp() {
        return dao.findAllInfoApp();
    }
    
    @Override
    public List<Informasi> findAllDokApp() {
        return dao.findAllDokApp();
    }
    
    @Override
    public List<Informasi> findAllPeraturanApp() {
        return dao.findAllPeraturanApp();
    }
    
    @Override
    public Informasi findByIDInfoApp(int id) {
        return dao.findByIDInfoApp(id);
    }
    
    @Override
    public Informasi findByIDDokApp(int id) {
        return dao.findByIDDokApp(id);
    }
    
    @Override
    public Informasi findByIDPeraturanApp(int id) {
        return dao.findByIDPeraturanApp(id);
    }
    
    @Override
    public Informasi createNewInfoApp() {
        return new Informasi();
    }
    
    @Override
    public Informasi saveInfoApp(Informasi obj) {
        return dao.saveInfoApp(obj);
    }
    
    @Override
    public Informasi updateInfoApp(Informasi obj) {
        return dao.updateInfoApp(obj);
    }
    
    @Override
    public void deleteInfoApp(int id) {
        dao.deleteOneInfoApp(id);
    }
    
    @Override
    public Informasi createNewDokApp() {
        return new Informasi();
    }
    
    @Override
    public Informasi saveDokApp(Informasi obj) {
        return dao.saveDokApp(obj);
    }
    
    @Override
    public Informasi updateDokApp(Informasi obj) {
        return dao.updateDokApp(obj);
    }
    
    @Override
    public void deleteDokApp(int id) {
        dao.deleteOneDokApp(id);
    }
    
    @Override
    public Informasi createNewPeraturanApp() {
        return new Informasi();
    }
    
    @Override
    public Informasi savePeraturanApp(Informasi obj) {
        return dao.savePeraturanApp(obj);
    }
    
    @Override
    public Informasi updatePeraturanApp(Informasi obj) {
        return dao.updatePeraturanApp(obj);
    }
    
    @Override
    public void deletePeraturanApp(int id) {
        dao.deleteOnePerApp(id);
    }
    
    @Override
    public Informasi findByIDOverview(int id) {
        return dao.findByIDOverview(id);
    }
    
    @Override
    public Informasi findByIDDisclaimer(int id) {
        return dao.findByIDDisclaimer(id);
    }
    
}
