use of com.tomasio.projects.trainning.model.Disciplina in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method findAllDisciplinasByCurriculoMinimo.
@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public DisciplinaDTO[] findAllDisciplinasByCurriculoMinimo(Long curriculoMinimoId) {
DisciplinaDAO dao = factory.getDisciplinaDAO();
DisciplinaDTO[] disciplinasArray = null;
try {
List<Disciplina> disciplinas = dao.findAllByCurriculoMinimo(curriculoMinimoId);
disciplinasArray = new DisciplinaDTO[disciplinas.size()];
for (int i = 0; i < disciplinasArray.length; i++) {
disciplinasArray[i] = disciplinas.get(i).createDTO();
}
} 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.toString());
}
return disciplinasArray;
}
use of com.tomasio.projects.trainning.model.Disciplina in project trainning by fernandotomasio.
the class HibernateDisciplinaDAO method remove.
@Override
public void remove(Long id) throws DAOException {
Session session = sessionFactory.getCurrentSession();
try {
Disciplina disciplina = (Disciplina) session.get(Disciplina.class, id);
session.delete(disciplina);
} catch (HibernateException e) {
Logger.getLogger(HibernateDisciplinaDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException("Erro ao remover Disciplina!");
}
}
use of com.tomasio.projects.trainning.model.Disciplina in project trainning by fernandotomasio.
the class HibernateDisciplinaDAO method find.
@Override
public Disciplina find(Long id) throws DAOException {
Session session = sessionFactory.getCurrentSession();
try {
Disciplina disciplina = (Disciplina) session.get(Disciplina.class, id);
fillDisciplina(disciplina);
return disciplina;
} catch (HibernateException e) {
Logger.getLogger(HibernateDisciplinaDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("disciplinas.find.unique.error"));
}
}
use of com.tomasio.projects.trainning.model.Disciplina in project trainning by fernandotomasio.
the class HibernateDisciplinaDAO method findAllByPUD.
@Override
public List<Disciplina> findAllByPUD(Long pudId) throws DAOException {
Session session = sessionFactory.getCurrentSession();
try {
Criteria criteria = session.createCriteria(Disciplina.class);
criteria.add(Restrictions.eq("planoUnidadesDidaticas.id", pudId));
criteria.addOrder(Order.asc("numeroDisciplina"));
@SuppressWarnings("unchecked") List<Disciplina> disciplinas = criteria.list();
for (Disciplina disciplina : disciplinas) {
fillDisciplina(disciplina);
}
return disciplinas;
} catch (HibernateException e) {
Logger.getLogger(HibernateDisciplinaDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("disciplinas.find.list.error"));
}
}
use of com.tomasio.projects.trainning.model.Disciplina in project trainning by fernandotomasio.
the class HibernateDisciplinaDAO method findAllByCurriculoMinimo.
@Override
public List<Disciplina> findAllByCurriculoMinimo(Long curriculoMinimoId) throws DAOException {
Session session = sessionFactory.getCurrentSession();
try {
Criteria criteria = session.createCriteria(Disciplina.class);
criteria.add(Restrictions.eq("curriculoMinimo.id", curriculoMinimoId));
criteria.addOrder(Order.asc("numeroDisciplina"));
@SuppressWarnings("unchecked") List<Disciplina> disciplinas = criteria.list();
for (Disciplina disciplina : disciplinas) {
fillDisciplina(disciplina);
}
return disciplinas;
} catch (HibernateException e) {
Logger.getLogger(HibernateDisciplinaDAO.class.getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("disciplinas.find.list.error"));
}
}
Aggregations