Search in sources :

Example 1 with PostoDTO

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

the class OrganizationalServiceSimpleImpl method findAllPostos.

@Override
@Transactional(readOnly = true)
public PostoDTO[] findAllPostos() {
    PostoDAO dao = factory.getPostoDAO();
    PostoDTO[] postosArray = null;
    try {
        List<Posto> postos = dao.findAll();
        postosArray = new PostoDTO[postos.size()];
        for (int i = 0; i < postosArray.length; i++) {
            postosArray[i] = postos.get(i).createDTO();
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return postosArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Posto(com.tomasio.projects.trainning.model.Posto) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PostoDTO(com.tomasio.projects.trainning.dto.PostoDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with PostoDTO

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

the class Posto method createDTO.

public PostoDTO createDTO() {
    PostoDTO dto = new PostoDTO();
    dto.setId(id);
    dto.setAntiguidade(antiguidade);
    dto.setDescricao(descricao);
    dto.setOficial(oficial);
    dto.setSigla(sigla);
    return dto;
}
Also used : PostoDTO(com.tomasio.projects.trainning.dto.PostoDTO)

Aggregations

PostoDTO (com.tomasio.projects.trainning.dto.PostoDTO)2 DAOException (com.tomasio.projects.trainning.exception.DAOException)1 CoreException (com.tomasio.projects.trainning.exeption.CoreException)1 Posto (com.tomasio.projects.trainning.model.Posto)1 Transactional (org.springframework.transaction.annotation.Transactional)1