Search in sources :

Example 1 with RecomendacaoMetodologica

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;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) RecomendacaoMetodologica(com.tomasio.projects.trainning.model.RecomendacaoMetodologica) CoreException(com.tomasio.projects.trainning.exeption.CoreException) DAOException(com.tomasio.projects.trainning.exception.DAOException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with RecomendacaoMetodologica

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());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) RecomendacaoMetodologica(com.tomasio.projects.trainning.model.RecomendacaoMetodologica) CoreException(com.tomasio.projects.trainning.exeption.CoreException) DAOException(com.tomasio.projects.trainning.exception.DAOException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with RecomendacaoMetodologica

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!");
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) RecomendacaoMetodologica(com.tomasio.projects.trainning.model.RecomendacaoMetodologica) HibernateException(org.hibernate.HibernateException) Session(org.hibernate.Session)

Example 4 with 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"));
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) RecomendacaoMetodologica(com.tomasio.projects.trainning.model.RecomendacaoMetodologica) HibernateException(org.hibernate.HibernateException) Criteria(org.hibernate.Criteria) Session(org.hibernate.Session)

Example 5 with RecomendacaoMetodologica

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;
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) RecomendacaoMetodologica(com.tomasio.projects.trainning.model.RecomendacaoMetodologica) CoreException(com.tomasio.projects.trainning.exeption.CoreException) DAOException(com.tomasio.projects.trainning.exception.DAOException) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

DAOException (com.tomasio.projects.trainning.exception.DAOException)6 RecomendacaoMetodologica (com.tomasio.projects.trainning.model.RecomendacaoMetodologica)6 CoreException (com.tomasio.projects.trainning.exeption.CoreException)4 Transactional (org.springframework.transaction.annotation.Transactional)4 HibernateException (org.hibernate.HibernateException)2 Session (org.hibernate.Session)2 RecomendacaoMetodologicaDTO (com.tomasio.projects.trainning.dto.RecomendacaoMetodologicaDTO)1 Criteria (org.hibernate.Criteria)1