package br.com.centralit.citcorpore.negocio;

import br.com.centralit.citcorpore.bean.TemplateServicoDTO;
import br.com.centralit.citcorpore.integracao.TemplateServicoDAO;
import br.com.citframework.service.CrudServiceImpl;

@SuppressWarnings("unchecked")
public class TemplateServicoServiceEjb extends CrudServiceImpl implements TemplateServicoService {

	private TemplateServicoDAO dao;

	@Override
	protected TemplateServicoDAO getDao() {
		if (dao == null) {
			dao = new TemplateServicoDAO();
		}

		return dao;
	}

	@Override
	public TemplateServicoDTO findById(final Integer idTemplateAcompanhamento) throws Exception {
		TemplateServicoDTO templateDto = new TemplateServicoDTO();
		templateDto.setIdTemplateServico(idTemplateAcompanhamento);
		templateDto = (TemplateServicoDTO) this.getDao().restore(templateDto);

		if (templateDto != null) {
			return templateDto;
		}

		return null;
	}
}