Search in sources :

Example 6 with ConsultaInstrutorDTO

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

the class InstructorsServiceSimpleImpl method findAllConsultaInstrutorByTurmaId.

@Override
@Transactional(readOnly = true)
public ConsultaInstrutorDTO[] findAllConsultaInstrutorByTurmaId(Long turmaId) {
    ConsultaInstrutorDAO dao = factory.getConsultaInstrutorDAO();
    ConsultaInstrutorDTO[] consultasArray = null;
    try {
        List<ConsultaInstrutor> consultas = dao.findAllByTurmaId(turmaId);
        if (consultas != null) {
            consultasArray = new ConsultaInstrutorDTO[consultas.size()];
            for (int i = 0; i < consultas.size(); i++) {
                consultasArray[i] = consultas.get(i).createDTO();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return consultasArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) ConsultaInstrutorDTO(com.tomasio.projects.trainning.dto.ConsultaInstrutorDTO) ConsultaInstrutor(com.tomasio.projects.trainning.model.ConsultaInstrutor) Transactional(org.springframework.transaction.annotation.Transactional)

Example 7 with ConsultaInstrutorDTO

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

the class InstructorsServiceSimpleImpl method findAllConsultaInstrutorByPessoaId.

@Override
@Transactional(readOnly = true)
public ConsultaInstrutorDTO[] findAllConsultaInstrutorByPessoaId(Long pessoaId, boolean finalizado) {
    ConsultaInstrutorDAO dao = factory.getConsultaInstrutorDAO();
    ConsultaInstrutorDTO[] consultasArray = null;
    try {
        List<ConsultaInstrutor> consultas = dao.findAllByPessoaId(pessoaId, finalizado);
        if (consultas != null) {
            consultasArray = new ConsultaInstrutorDTO[consultas.size()];
            for (int i = 0; i < consultas.size(); i++) {
                consultasArray[i] = consultas.get(i).createDTO();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return consultasArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) ConsultaInstrutorDTO(com.tomasio.projects.trainning.dto.ConsultaInstrutorDTO) ConsultaInstrutor(com.tomasio.projects.trainning.model.ConsultaInstrutor) Transactional(org.springframework.transaction.annotation.Transactional)

Example 8 with ConsultaInstrutorDTO

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

the class ConsultaInstrutor method createDTO.

@Override
public ConsultaInstrutorDTO createDTO() {
    ConsultaInstrutorDTO dto = new ConsultaInstrutorDTO();
    dto.setConclusao(conclusao);
    dto.setDataConsulta(dataConsulta);
    dto.setEmailCC(emailCC);
    dto.setEmailTo(emailTo);
    dto.setEvento(evento);
    dto.setFinalizado(finalizado);
    dto.setId(id);
    dto.setPeriodo(periodo);
    dto.setPrazoResposta(prazoResposta);
    dto.setText(text);
    if (pessoa != null) {
        dto.setPessoa(pessoa.createDTO());
    }
    if (turma != null) {
        dto.setTurma(turma.createDTOWithoutDependencies());
    }
    return dto;
}
Also used : ConsultaInstrutorDTO(com.tomasio.projects.trainning.dto.ConsultaInstrutorDTO)

Aggregations

ConsultaInstrutorDTO (com.tomasio.projects.trainning.dto.ConsultaInstrutorDTO)8 DAOException (com.tomasio.projects.trainning.exception.DAOException)3 CoreException (com.tomasio.projects.trainning.exeption.CoreException)3 ConsultaInstrutor (com.tomasio.projects.trainning.model.ConsultaInstrutor)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 Transactional (org.springframework.transaction.annotation.Transactional)3 PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)2 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)2 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 List (java.util.List)2 Calendar (java.util.Calendar)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1