Search in sources :

Example 1 with ConsultaInstrutor

use of com.tomasio.projects.trainning.model.ConsultaInstrutor in project trainning by fernandotomasio.

the class InstructorsServiceSimpleImpl method findAllConsultaInstrutorByRemetenteId.

@Override
@Transactional(readOnly = true)
public ConsultaInstrutorDTO[] findAllConsultaInstrutorByRemetenteId(Long remetenteId, boolean finalizado) {
    ConsultaInstrutorDAO dao = factory.getConsultaInstrutorDAO();
    ConsultaInstrutorDTO[] consultasArray = null;
    try {
        List<ConsultaInstrutor> consultas = dao.findAllByRemetenteId(remetenteId, 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 2 with ConsultaInstrutor

use of com.tomasio.projects.trainning.model.ConsultaInstrutor in project trainning by fernandotomasio.

the class InstructorsServiceSimpleImpl method updateConsultaInstrutor.

@Override
@Transactional
public void updateConsultaInstrutor(ConsultaInstrutorDTO consultaInstrutor) {
    ConsultaInstrutorDAO dao = factory.getConsultaInstrutorDAO();
    ConsultaInstrutor model = new ConsultaInstrutor(consultaInstrutor);
    update(dao, model);
}
Also used : ConsultaInstrutor(com.tomasio.projects.trainning.model.ConsultaInstrutor) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with ConsultaInstrutor

use of com.tomasio.projects.trainning.model.ConsultaInstrutor in project trainning by fernandotomasio.

the class InstructorsServiceSimpleImpl method createConsultaInstrutor.

@Override
@Transactional
public Long createConsultaInstrutor(ConsultaInstrutorDTO consultaInstrutor) {
    ConsultaInstrutorDAO dao = factory.getConsultaInstrutorDAO();
    ConsultaInstrutor model = new ConsultaInstrutor(consultaInstrutor);
    return create(dao, model);
}
Also used : ConsultaInstrutor(com.tomasio.projects.trainning.model.ConsultaInstrutor) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with ConsultaInstrutor

use of com.tomasio.projects.trainning.model.ConsultaInstrutor in project trainning by fernandotomasio.

the class InstructorsServiceSimpleImpl method findConsultaInstrutor.

@Override
@Transactional(readOnly = true)
public ConsultaInstrutorDTO findConsultaInstrutor(Long id) {
    ConsultaInstrutorDAO dao = factory.getConsultaInstrutorDAO();
    ConsultaInstrutor consulta = (ConsultaInstrutor) find(dao, id);
    if (consulta != null) {
        return consulta.createDTO();
    } else {
        return null;
    }
}
Also used : ConsultaInstrutor(com.tomasio.projects.trainning.model.ConsultaInstrutor) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with ConsultaInstrutor

use of com.tomasio.projects.trainning.model.ConsultaInstrutor 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)

Aggregations

ConsultaInstrutor (com.tomasio.projects.trainning.model.ConsultaInstrutor)6 Transactional (org.springframework.transaction.annotation.Transactional)6 ConsultaInstrutorDTO (com.tomasio.projects.trainning.dto.ConsultaInstrutorDTO)3 DAOException (com.tomasio.projects.trainning.exception.DAOException)3 CoreException (com.tomasio.projects.trainning.exeption.CoreException)3