/*
 * 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.sikd5.sikd5ejb.dao;

import java.util.ArrayList;
import java.util.List;

import org.apache.ibatis.session.SqlSession;

import sikd.sikd5.sikd5bean.fault.SIKDServiceException;
import sikd.sikd5.sikd5bean.tabel.Pemda;
import sikd.sikd5.sikd5bean.tabel.TahunAnggaran;
import sikd.sikd5.sikd5ejb.mapper.SettingsMapper;

/**
 *
 * @author : agus
 * @tanggal : Des 20, 2018
 */
public class SettingsDao {

	public List<TahunAnggaran> getTahuns(SqlSession session) throws SIKDServiceException {
		List<TahunAnggaran> hasil = new ArrayList<TahunAnggaran>();
		try {
			SettingsMapper mapper = session.getMapper(SettingsMapper.class);
			hasil = mapper.getTahuns();
			return hasil;
		} catch (Exception e) {
			throw new SIKDServiceException(e.getMessage());
		}

	}

	public List<Pemda> getProvByTahuns(short tahun, SqlSession session) throws SIKDServiceException {
		List<Pemda> hasil = new ArrayList<Pemda>();
		try {
			SettingsMapper mapper = session.getMapper(SettingsMapper.class);
			hasil = mapper.getProvByTahuns(tahun);
			return hasil;
		} catch (Exception e) {
			throw new SIKDServiceException(e.getMessage());
		}

	}

	public List<Pemda> getPemdaByTahuns(short tahun, SqlSession session) throws SIKDServiceException {
		List<Pemda> hasil = new ArrayList<Pemda>();
		try {
			SettingsMapper mapper = session.getMapper(SettingsMapper.class);
			hasil = mapper.getPemdaByTahuns(tahun);
			return hasil;
		} catch (Exception e) {
			throw new SIKDServiceException(e.getMessage());
		}

	}
}
