Search in sources :

Example 1 with CurriculoMinimo

use of com.tomasio.projects.trainning.model.CurriculoMinimo in project trainning by fernandotomasio.

the class TeachingDocumentsServiceSimpleImpl method findAllCurriculosMinimos.

@Override
@Transactional(readOnly = true)
public CurriculoMinimoDTO[] findAllCurriculosMinimos() {
    CurriculoMinimoDAO dao = factory.getCurriculoMinimoDAO();
    CurriculoMinimoDTO[] curriculosArray = null;
    try {
        List<CurriculoMinimo> curriculos = dao.findAllCurriculosMinimos();
        if (curriculos != null) {
            curriculosArray = new CurriculoMinimoDTO[curriculos.size()];
            for (int i = 0; i < curriculos.size(); i++) {
                curriculosArray[i] = curriculos.get(i).createDTO();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return curriculosArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) CurriculoMinimo(com.tomasio.projects.trainning.model.CurriculoMinimo) CurriculoMinimoDTO(com.tomasio.projects.trainning.dto.CurriculoMinimoDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with CurriculoMinimo

use of com.tomasio.projects.trainning.model.CurriculoMinimo in project trainning by fernandotomasio.

the class TeachingDocumentsServiceSimpleImpl method createCurriculoMinimo.

@Override
@Transactional
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public Long createCurriculoMinimo(CurriculoMinimoDTO curriculo) {
    CurriculoMinimoDAO dao = factory.getCurriculoMinimoDAO();
    CurriculoMinimo model = new CurriculoMinimo(curriculo);
    Long id = null;
    try {
        id = dao.create(model);
    } catch (DAOException ex) {
        throw new CoreException(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) CurriculoMinimo(com.tomasio.projects.trainning.model.CurriculoMinimo) CoreException(com.tomasio.projects.trainning.exeption.CoreException) DAOException(com.tomasio.projects.trainning.exception.DAOException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with CurriculoMinimo

use of com.tomasio.projects.trainning.model.CurriculoMinimo in project trainning by fernandotomasio.

the class TeachingDocumentsServiceSimpleImpl method updateCurriculoMinimo.

@Override
@Transactional
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public void updateCurriculoMinimo(CurriculoMinimoDTO curriculo) {
    CurriculoMinimoDAO dao = factory.getCurriculoMinimoDAO();
    CurriculoMinimo model = new CurriculoMinimo(curriculo);
    try {
        dao.update(model);
    } catch (DAOException ex) {
        throw new CoreException(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) CurriculoMinimo(com.tomasio.projects.trainning.model.CurriculoMinimo) CoreException(com.tomasio.projects.trainning.exeption.CoreException) DAOException(com.tomasio.projects.trainning.exception.DAOException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with CurriculoMinimo

use of com.tomasio.projects.trainning.model.CurriculoMinimo in project trainning by fernandotomasio.

the class HibernateCurriculoMinimoDAO method remove.

@Override
public void remove(Long id) throws DAOException {
    Session session = sessionFactory.getCurrentSession();
    try {
        CurriculoMinimo curriculo = (CurriculoMinimo) session.get(CurriculoMinimo.class, id);
        session.delete(curriculo);
    } catch (HibernateException e) {
        Logger.getLogger(HibernateCursoDAO.class.getName()).log(Level.SEVERE, null, e);
        throw new DAOException(MessageHelper.getMessage("curriculos.update.error"));
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) HibernateException(org.hibernate.HibernateException) CurriculoMinimo(com.tomasio.projects.trainning.model.CurriculoMinimo) Session(org.hibernate.Session)

Example 5 with CurriculoMinimo

use of com.tomasio.projects.trainning.model.CurriculoMinimo in project trainning by fernandotomasio.

the class TeachingDocumentsServiceSimpleImpl method findCurriculoMinimo.

@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public CurriculoMinimoDTO findCurriculoMinimo(Long curriculoId) {
    CurriculoMinimoDAO dao = factory.getCurriculoMinimoDAO();
    CurriculoMinimo curriculo = null;
    try {
        curriculo = dao.find(curriculoId);
    } catch (DAOException ex) {
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        throw new CoreException("Erro de sistema: " + ex.getMessage());
    }
    if (curriculo != null) {
        return curriculo.createDTO();
    } else {
        return null;
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) CurriculoMinimo(com.tomasio.projects.trainning.model.CurriculoMinimo) 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 CurriculoMinimo (com.tomasio.projects.trainning.model.CurriculoMinimo)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 CurriculoMinimoDTO (com.tomasio.projects.trainning.dto.CurriculoMinimoDTO)1 Curso (com.tomasio.projects.trainning.model.Curso)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1