Search in sources :

Example 6 with PlanoDAO

use of com.tomasio.projects.trainning.dao.PlanoDAO in project trainning by fernandotomasio.

the class TrainningServiceSimpleImpl method searchPlanoBySigla.

@Override
@Transactional(readOnly = true)
public PlanoDTO[] searchPlanoBySigla(String term) {
    PlanoDAO dao = factory.getPlanoDAO();
    PlanoDTO[] planosArray = null;
    try {
        List<Plano> planos = dao.searchBySigla(term);
        if (planos != null) {
            planosArray = new PlanoDTO[planos.size()];
            for (int i = 0; i < planos.size(); i++) {
                planosArray[i] = planos.get(i).createDTOWithoutDependencies();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return planosArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) PlanoDTO(com.tomasio.projects.trainning.dto.PlanoDTO) Plano(com.tomasio.projects.trainning.model.Plano) Transactional(org.springframework.transaction.annotation.Transactional)

Example 7 with PlanoDAO

use of com.tomasio.projects.trainning.dao.PlanoDAO in project trainning by fernandotomasio.

the class TrainningServiceSimpleImpl method searchPlanoByDescricao.

@Override
@Transactional(readOnly = true)
public PlanoDTO[] searchPlanoByDescricao(String term) {
    PlanoDAO dao = factory.getPlanoDAO();
    PlanoDTO[] planosArray = null;
    try {
        List<Plano> planos = dao.searchByDescricao(term);
        if (planos != null) {
            planosArray = new PlanoDTO[planos.size()];
            for (int i = 0; i < planos.size(); i++) {
                planosArray[i] = planos.get(i).createDTOWithoutDependencies();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return planosArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) PlanoDTO(com.tomasio.projects.trainning.dto.PlanoDTO) Plano(com.tomasio.projects.trainning.model.Plano) Transactional(org.springframework.transaction.annotation.Transactional)

Example 8 with PlanoDAO

use of com.tomasio.projects.trainning.dao.PlanoDAO in project trainning by fernandotomasio.

the class TrainningServiceSimpleImpl method findPlanoBySigla.

@Override
@Transactional(readOnly = true)
public PlanoDTO findPlanoBySigla(String sigla) {
    PlanoDAO dao = factory.getPlanoDAO();
    Plano plano = null;
    try {
        plano = dao.findBySigla(sigla);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    if (plano != null) {
        return plano.createDTO();
    } else {
        return null;
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) Plano(com.tomasio.projects.trainning.model.Plano) Transactional(org.springframework.transaction.annotation.Transactional)

Example 9 with PlanoDAO

use of com.tomasio.projects.trainning.dao.PlanoDAO in project trainning by fernandotomasio.

the class TrainningServiceSimpleImpl method findAllPlanos.

@Override
@Transactional(readOnly = true)
public PlanoDTO[] findAllPlanos() {
    PlanoDAO dao = factory.getPlanoDAO();
    List<Plano> planos = (List<Plano>) findAll(dao);
    List<PlanoDTO> dtos = new ArrayList<>();
    assemblyDTO(dtos, planos, PlanoDTO.class, Plano.class);
    PlanoDTO[] resultArray = dtos.toArray(new PlanoDTO[dtos.size()]);
    return resultArray;
}
Also used : ArrayList(java.util.ArrayList) PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) ArrayList(java.util.ArrayList) List(java.util.List) Plano(com.tomasio.projects.trainning.model.Plano) PlanoDTO(com.tomasio.projects.trainning.dto.PlanoDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 10 with PlanoDAO

use of com.tomasio.projects.trainning.dao.PlanoDAO in project trainning by fernandotomasio.

the class TrainningServiceSimpleImpl method findPlano.

@Override
@Transactional(readOnly = true)
public PlanoDTO findPlano(Long id) {
    PlanoDAO dao = factory.getPlanoDAO();
    Plano plano = (Plano) find(dao, id);
    if (plano != null) {
        PlanoDTO dto = new PlanoDTO();
        assemblyDTO(dto, plano);
        return dto;
    } else {
        return null;
    }
}
Also used : PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) Plano(com.tomasio.projects.trainning.model.Plano) PlanoDTO(com.tomasio.projects.trainning.dto.PlanoDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

PlanoDAO (com.tomasio.projects.trainning.dao.PlanoDAO)11 Transactional (org.springframework.transaction.annotation.Transactional)10 Plano (com.tomasio.projects.trainning.model.Plano)8 PlanoDTO (com.tomasio.projects.trainning.dto.PlanoDTO)6 DAOException (com.tomasio.projects.trainning.exception.DAOException)6 CoreException (com.tomasio.projects.trainning.exeption.CoreException)6 ParseException (java.text.ParseException)2 DAOFactory (com.tomasio.projects.trainning.dao.DAOFactory)1 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1