Search in sources :

Example 1 with Turma

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

the class PlanningServiceSimpleImpl method createTurma.

@Override
@Transactional
public Long createTurma(TurmaDTO turma) {
    TurmaDAO dao = factory.getTurmaDAO();
    Turma _turma = new TurmaPlanejada((TurmaPlanejadaDTO) turma);
    Long id = null;
    try {
        id = dao.create(_turma);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return id;
}
Also used : TurmaPlanejada(com.tomasio.projects.trainning.model.TurmaPlanejada) DAOException(com.tomasio.projects.trainning.exception.DAOException) Turma(com.tomasio.projects.trainning.model.Turma) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with Turma

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

the class PlanningServiceSimpleImpl method findTurma.

@Override
@Transactional(readOnly = true)
public TurmaDTO findTurma(Long id) {
    TurmaDAO dao = factory.getTurmaDAO();
    Turma turma = null;
    try {
        turma = dao.find(id);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    if (turma != null) {
        return (TurmaPlanejadaDTO) turma.createDTO();
    } else {
        return null;
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Turma(com.tomasio.projects.trainning.model.Turma) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with Turma

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

the class AtividadesEnsinoServiceSimpleImpl method findAllTurmas.

@Override
@Transactional(readOnly = true)
public TurmaDTO[] findAllTurmas(Long[] ids) {
    if (ids == null || ids.length <= 0) {
        return new TurmaDTO[0];
    }
    TurmaDAO dao = factory.getTurmaDAO();
    TurmaDTO[] turmasArray = null;
    try {
        List<Turma> turmas = dao.findAll(Arrays.asList(ids));
        // }
        if (turmas != null) {
            turmasArray = new TurmaDTO[turmas.size()];
            for (int i = 0; i < turmas.size(); i++) {
                turmasArray[i] = turmas.get(i).createDTOWithoutDependencies();
            }
        }
    } catch (DAOException ex) {
        ex.printStackTrace();
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
    }
    return turmasArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Turma(com.tomasio.projects.trainning.model.Turma) CoreException(com.tomasio.projects.trainning.exeption.CoreException) TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO) TurmaDAO(com.tomasio.projects.trainning.dao.TurmaDAO) DAOException(com.tomasio.projects.trainning.exception.DAOException) ParseException(java.text.ParseException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with Turma

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

the class HibernateTurmaDAO method instantiateTurma.

@SuppressWarnings("unused")
private Turma instantiateTurma(TurmaDTO dto) {
    Turma turma;
    if (dto instanceof TurmaEfetivaDTO) {
        TurmaEfetivaDTO aux = (TurmaEfetivaDTO) dto;
        turma = new TurmaEfetiva(aux);
    } else {
        TurmaPlanejadaDTO aux = (TurmaPlanejadaDTO) dto;
        turma = new TurmaPlanejada(aux);
    }
    return turma;
}
Also used : TurmaPlanejada(com.tomasio.projects.trainning.model.TurmaPlanejada) TurmaEfetivaDTO(com.tomasio.projects.trainning.dto.TurmaEfetivaDTO) Turma(com.tomasio.projects.trainning.model.Turma) StatusTurmaEfetiva(com.tomasio.projects.trainning.model.StatusTurmaEfetiva) TurmaEfetiva(com.tomasio.projects.trainning.model.TurmaEfetiva) TurmaPlanejadaDTO(com.tomasio.projects.trainning.dto.TurmaPlanejadaDTO)

Example 5 with Turma

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

the class AtividadesEnsinoServiceSimpleImpl method findTurmaEfetiva.

@Override
@Transactional(readOnly = true)
public TurmaEfetivaDTO findTurmaEfetiva(Long turmaId) {
    TurmaDAO dao = factory.getTurmaDAO();
    Turma turma = null;
    try {
        turma = dao.find(turmaId);
    } catch (DAOException ex) {
        ex.printStackTrace();
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
    }
    if (turma != null) {
        // proccessarPendencias((TurmaEfetiva) turma);
        TurmaEfetivaDTO dto = (TurmaEfetivaDTO) turma.createDTO();
        return dto;
    } else {
        return null;
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) TurmaEfetivaDTO(com.tomasio.projects.trainning.dto.TurmaEfetivaDTO) Turma(com.tomasio.projects.trainning.model.Turma) CoreException(com.tomasio.projects.trainning.exeption.CoreException) TurmaDAO(com.tomasio.projects.trainning.dao.TurmaDAO) DAOException(com.tomasio.projects.trainning.exception.DAOException) ParseException(java.text.ParseException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Turma (com.tomasio.projects.trainning.model.Turma)7 DAOException (com.tomasio.projects.trainning.exception.DAOException)6 CoreException (com.tomasio.projects.trainning.exeption.CoreException)4 Transactional (org.springframework.transaction.annotation.Transactional)4 TurmaDAO (com.tomasio.projects.trainning.dao.TurmaDAO)2 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)2 StatusTurmaEfetiva (com.tomasio.projects.trainning.model.StatusTurmaEfetiva)2 TurmaEfetiva (com.tomasio.projects.trainning.model.TurmaEfetiva)2 TurmaPlanejada (com.tomasio.projects.trainning.model.TurmaPlanejada)2 ParseException (java.text.ParseException)2 HibernateException (org.hibernate.HibernateException)2 Session (org.hibernate.Session)2 TurmaDTO (com.tomasio.projects.trainning.dto.TurmaDTO)1 TurmaPlanejadaDTO (com.tomasio.projects.trainning.dto.TurmaPlanejadaDTO)1