use of com.tomasio.projects.trainning.model.RecomendacaoMetodologica in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method createRecomendacaoMetodologica.
@Override
@Transactional
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public Long createRecomendacaoMetodologica(RecomendacaoMetodologicaDTO recomendacao) {
RecomendacaoMetodologicaDAO dao = factory.getRecomendacaoMetodologicaDAO();
RecomendacaoMetodologica model = new RecomendacaoMetodologica(recomendacao);
Long id = null;
try {
id = dao.create(model);
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
} catch (Exception ex) {
throw new CoreException("Erro de sistema: " + ex.getMessage());
}
return id;
}
use of com.tomasio.projects.trainning.model.RecomendacaoMetodologica in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method updateRecomendacaoMetodologica.
@Override
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
@Transactional
public void updateRecomendacaoMetodologica(RecomendacaoMetodologicaDTO recomendacao) {
RecomendacaoMetodologicaDAO dao = factory.getRecomendacaoMetodologicaDAO();
RecomendacaoMetodologica model = new RecomendacaoMetodologica(recomendacao);
try {
dao.update(model);
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
} catch (Exception ex) {
throw new CoreException("Erro de sistema: " + ex.getMessage());
}
}
use of com.tomasio.projects.trainning.model.RecomendacaoMetodologica in project trainning by fernandotomasio.
the class HibernateRecomendacaoMetotodogicaDAO method remove.
@Override
public void remove(Long id) throws DAOException {
Session session = sessionFactory.getCurrentSession();
RecomendacaoMetodologica recomendacao = (RecomendacaoMetodologica) session.get(RecomendacaoMetodologica.class, id);
try {
session.delete(recomendacao);
} catch (HibernateException e) {
Logger.getLogger(HibernateRecomendacaoMetotodogicaDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException("Erro ao remover RecomendacaoMetodologica!");
}
}
use of com.tomasio.projects.trainning.model.RecomendacaoMetodologica in project trainning by fernandotomasio.
the class HibernateRecomendacaoMetotodogicaDAO method findAll.
@Override
public List<RecomendacaoMetodologica> findAll(Long disciplinaId) throws DAOException {
Session session = sessionFactory.getCurrentSession();
try {
Criteria criteria = session.createCriteria(RecomendacaoMetodologica.class);
criteria.add(Restrictions.eq("disciplina.id", disciplinaId));
@SuppressWarnings("unchecked") List<RecomendacaoMetodologica> recomendacoes = criteria.list();
return recomendacoes;
} catch (HibernateException e) {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("recomendacoes.find.list.error"));
}
}
use of com.tomasio.projects.trainning.model.RecomendacaoMetodologica in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method findRecomendacaoMetodologica.
@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public RecomendacaoMetodologicaDTO findRecomendacaoMetodologica(Long id) {
RecomendacaoMetodologicaDAO dao = factory.getRecomendacaoMetodologicaDAO();
RecomendacaoMetodologica recomendacao = null;
try {
recomendacao = dao.find(id);
} catch (DAOException ex) {
throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
} catch (Exception ex) {
throw new CoreException("Erro de sistema: " + ex.getMessage());
}
if (recomendacao != null) {
return recomendacao.createDTO();
} else {
return null;
}
}
Aggregations