Search in sources :

Example 16 with AreaDTO

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

the class TrainningServiceSimpleImpl method findAllAreasByPlanejamentoId.

@Override
@Transactional(readOnly = true)
public AreaDTO[] findAllAreasByPlanejamentoId(Long planejamentoId) {
    AreaDAO dao = factory.getAreaDAO();
    AreaDTO[] areasArray = null;
    try {
        List<Area> areas = dao.findAllAreasByPlanejamento(planejamentoId);
        if (areas != null) {
            areasArray = new AreaDTO[areas.size()];
            for (int i = 0; i < areas.size(); i++) {
                areasArray[i] = areas.get(i).createDTO();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return areasArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Area(com.tomasio.projects.trainning.model.Area) CoreException(com.tomasio.projects.trainning.exeption.CoreException) AreaDTO(com.tomasio.projects.trainning.dto.AreaDTO) AreaDAO(com.tomasio.projects.trainning.dao.AreaDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 17 with AreaDTO

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

the class TrainningServiceSimpleImpl method searchArea.

@Override
@Transactional(readOnly = true)
public AreaDTO[] searchArea(String term) {
    AreaDAO dao = factory.getAreaDAO();
    AreaDTO[] areasArray = null;
    try {
        List<Area> areas = dao.search(term);
        if (areas != null) {
            areasArray = new AreaDTO[areas.size()];
            for (int i = 0; i < areas.size(); i++) {
                areasArray[i] = areas.get(i).createDTO();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return areasArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Area(com.tomasio.projects.trainning.model.Area) CoreException(com.tomasio.projects.trainning.exeption.CoreException) AreaDTO(com.tomasio.projects.trainning.dto.AreaDTO) AreaDAO(com.tomasio.projects.trainning.dao.AreaDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

AreaDTO (com.tomasio.projects.trainning.dto.AreaDTO)17 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)8 CoreException (com.tomasio.projects.trainning.exeption.CoreException)7 AreaDAO (com.tomasio.projects.trainning.dao.AreaDAO)4 ItemPlanejamentoDTO (com.tomasio.projects.trainning.dto.ItemPlanejamentoDTO)4 PlanejamentoDTO (com.tomasio.projects.trainning.dto.PlanejamentoDTO)4 ResponsavelAreaDTO (com.tomasio.projects.trainning.dto.ResponsavelAreaDTO)4 DAOException (com.tomasio.projects.trainning.exception.DAOException)4 Area (com.tomasio.projects.trainning.model.Area)4 ArrayList (java.util.ArrayList)4 Transactional (org.springframework.transaction.annotation.Transactional)4 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)3 CursoDTO (com.tomasio.projects.trainning.dto.CursoDTO)2 StripItemPlanejamentoDTO (com.tomasio.projects.trainning.dto.StripItemPlanejamentoDTO)2 AreaForm (com.tomasio.projects.trainning.form.AreaForm)2 ParseException (java.text.ParseException)2 SimpleDateFormat (java.text.SimpleDateFormat)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 AcaoDTO (com.tomasio.projects.trainning.dto.AcaoDTO)1