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

/**
 *
 * @author Imam Bhoim
 */
@Stateless
public class BaganAkunStandarEjbHomeImpl implements BaganAkunStandarEjbHome {

    private SqlSessionFactory sqlSessionFactory;
    private SqlSession session = null;

    private BaganAkunStandarDao dao;

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

    @Override
    public List<BaganAkunStandar> findAll() {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return dao.findAll();
    }

    @Override
    public BaganAkunStandar findByID(int id) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public BaganAkunStandar createNew() {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return new BaganAkunStandar();
    }

    @Override
    public BaganAkunStandar save(BaganAkunStandar obj) {
        //    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return dao.save(obj);
    }

    @Override
    public BaganAkunStandar findByKode(String kode) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public BaganAkunStandar update(BaganAkunStandar obj) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return dao.update(obj);
    }

    @Override
    public List<BaganAkunStandar> findAllLevel1(int idbas) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return dao.findAllLevel1(idbas);
    }

    @Override
    public List<BaganAkunStandar> findAllLevel2ByLevel1(int lvl1, int idbas) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return dao.findAllLevel2ByLevel1(lvl1, idbas);
    }

    @Override
    public List<BaganAkunStandar> findAllLevel2() {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return dao.findAllLevel2();
    }

    @Override
    public BaganAkunStandar findByKodeLvl12(int lvl1, int lvl2, int lvl3, int idbas) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return dao.findKodelvl12(lvl1, lvl2, lvl3, idbas);
    }
    
     @Override
    public BaganAkunStandar findByKodeLvl12limit(int lvl1, int lvl2, int lvl3, int idbas) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return dao.findKodelvl12limit(lvl1, lvl2, lvl3, idbas);
    }

    @Override
    public List<BaganAkunStandar> findByLevel1(int lvl1, int idbas) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    return dao.findByLevel1(lvl1, idbas);
    }

    @Override
    public List<BaganAkunStandar> findByLevel2(int lvl1, int lvl2, int idbas) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    return dao.findByLevel2(lvl1,lvl2, idbas);
    }

    @Override
    public List<BaganAkunStandar> findAllLevel4() {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    return dao.findAllLevel4();
    }

    @Override
    public List<BaganAkunStandar> findAllLevel5() {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    return dao.findAllLevel5();
    }

    @Override
    public List<BaganAkunStandar> findAllByJenisBas(int id) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    return dao.findAllByJenisBas(id);
    }

    @Override
    public BaganAkunStandar findByKodeLvl123(int lvl1, int lvl2, int lvl3, String lvl4, int idbas) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
       return dao.findKodelvl123(lvl1, lvl2, lvl3, lvl4, idbas);
    }

    @Override
    public BaganAkunStandar saveLevel4(BaganAkunStandar obj) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    return dao.saveLevel4(obj);
    }

    @Override
    public List<BaganAkunStandar> findAllLevel3ByLevel2(int lvl2, int idbas) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
     return dao.findAllLevel3ByLevel2(lvl2, idbas);
    }

    @Override
    public List<BaganAkunStandar> findAllLevel4ByLevel3(int lvl3, int idbas) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
     return dao.findAllLevel4ByLevel3(lvl3, idbas);
    }

    @Override
    public BaganAkunStandar findByKodeLvl1234(int lvl1, int lvl2, int lvl3, String lvl4, String lvl5, int idbas) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    return dao.findKodelvl1234(lvl1, lvl2, lvl3, lvl4, lvl5, idbas);
    }

    @Override
    public BaganAkunStandar saveLevel5(BaganAkunStandar obj) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
     return dao.saveLevel5(obj);
    }

    @Override
    public void delete(int lvl1, int lvl2, int lvl3, String lvl4, String lvl5, int idbas) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    dao.deleteKode(lvl1, lvl2, lvl3, lvl4, lvl5, idbas);
    }

    @Override
    public BaganAkunStandar saveImport(BaganAkunStandar obj) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    return dao.saveImport(obj);
    }


}
