Search in sources :

Example 36 with ItemPlanejamentoDTO

use of com.tomasio.projects.trainning.dto.ItemPlanejamentoDTO in project trainning by fernandotomasio.

the class HibernateItemPlanejamentoDAO method findAll.

@Override
public List<ItemPlanejamentoDTO> findAll(Long planejamentoId) throws DAOException {
    Session session = sessionFactory.getCurrentSession();
    try {
        @SuppressWarnings("unchecked") List<ItemPlanejamento> items = session.createQuery("from ItemPlanejamento item " + " where item.planejamento.id=:param order by item.curso.codigo").setLong("param", planejamentoId).list();
        List<ItemPlanejamentoDTO> dto = new ArrayList<ItemPlanejamentoDTO>();
        for (ItemPlanejamento item : items) {
            ItemPlanejamentoDTO itemDTO = item.createDTOWithoutDependencies();
            dto.add(itemDTO);
        }
        return dto;
    } catch (HibernateException e) {
        Logger.getLogger(HibernateItemPlanejamentoDAO.class.getName()).log(Level.SEVERE, null, e);
        throw new DAOException(MessageHelper.getMessage("planejamento.itens.find.list.error"));
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) ItemPlanejamentoDTO(com.tomasio.projects.trainning.dto.ItemPlanejamentoDTO) HibernateException(org.hibernate.HibernateException) ArrayList(java.util.ArrayList) ItemPlanejamento(com.tomasio.projects.trainning.model.ItemPlanejamento) Session(org.hibernate.Session)

Aggregations

ItemPlanejamentoDTO (com.tomasio.projects.trainning.dto.ItemPlanejamentoDTO)36 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)18 StripItemPlanejamentoDTO (com.tomasio.projects.trainning.dto.StripItemPlanejamentoDTO)14 ArrayList (java.util.ArrayList)12 Map (java.util.Map)12 HashMap (java.util.HashMap)11 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)7 CursoDTO (com.tomasio.projects.trainning.dto.CursoDTO)6 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)6 TreinamentoSolicitadoDTO (com.tomasio.projects.trainning.dto.TreinamentoSolicitadoDTO)6 TurmaPlanejadaDTO (com.tomasio.projects.trainning.dto.TurmaPlanejadaDTO)6 PlanejamentoDTO (com.tomasio.projects.trainning.dto.PlanejamentoDTO)5 ResponsavelAreaDTO (com.tomasio.projects.trainning.dto.ResponsavelAreaDTO)5 DAOException (com.tomasio.projects.trainning.exception.DAOException)4 HashSet (java.util.HashSet)4 FaseDTO (com.tomasio.projects.trainning.dto.FaseDTO)3 GroupTreinamentoSolicitadoForm (com.tomasio.projects.trainning.form.GroupTreinamentoSolicitadoForm)3 TreinamentoSolicitadoForm (com.tomasio.projects.trainning.form.TreinamentoSolicitadoForm)3 ItemPlanejamento (com.tomasio.projects.trainning.model.ItemPlanejamento)3 List (java.util.List)3