Search in sources :

Example 6 with DistribuicaoDAO

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

the class AtividadesEnsinoServiceSimpleImpl method findDistribuicao.

@Override
@Transactional(readOnly = true)
public DistribuicaoDTO findDistribuicao(Long distribuicaoId) {
    DistribuicaoDAO dao = factory.getDistribuicaoDAO();
    Distribuicao distribuicao = null;
    try {
        distribuicao = dao.find(distribuicaoId);
    } 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 (distribuicao != null) {
        return distribuicao.createDTO();
    } else {
        return null;
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Distribuicao(com.tomasio.projects.trainning.model.Distribuicao) DistribuicaoDAO(com.tomasio.projects.trainning.dao.DistribuicaoDAO) 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 7 with DistribuicaoDAO

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

the class AtividadesEnsinoServiceSimpleImpl method updateDistribuicao.

@Override
@Transactional
public void updateDistribuicao(DistribuicaoDTO distribuicao) {
    DistribuicaoDAO dao = factory.getDistribuicaoDAO();
    Distribuicao _distribuicao = new Distribuicao(distribuicao);
    try {
        dao.update(_distribuicao);
    } 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());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Distribuicao(com.tomasio.projects.trainning.model.Distribuicao) DistribuicaoDAO(com.tomasio.projects.trainning.dao.DistribuicaoDAO) 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 8 with DistribuicaoDAO

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

the class AtividadesEnsinoServiceSimpleImpl method createDistribuicao.

@Override
@Transactional
public Long createDistribuicao(DistribuicaoDTO distribuicao) {
    DistribuicaoDAO dao = factory.getDistribuicaoDAO();
    Distribuicao _distribuicao = new Distribuicao(distribuicao);
    Long id = null;
    try {
        id = dao.create(_distribuicao);
    } 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 id;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Distribuicao(com.tomasio.projects.trainning.model.Distribuicao) DistribuicaoDAO(com.tomasio.projects.trainning.dao.DistribuicaoDAO) 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 9 with DistribuicaoDAO

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

the class AtividadesEnsinoServiceSimpleImpl method findAllDistribuicoesByOrganizacao.

@Override
@Transactional(readOnly = true)
public DistribuicaoDTO[] findAllDistribuicoesByOrganizacao(Long organizacaoId) {
    DistribuicaoDAO dao = factory.getDistribuicaoDAO();
    DistribuicaoDTO[] distribuicoesArray = null;
    try {
        List<Distribuicao> distribuicoes = dao.findAllByOrganizacao(organizacaoId);
        if (distribuicoes != null) {
            distribuicoesArray = new DistribuicaoDTO[distribuicoes.size()];
            for (int i = 0; i < distribuicoes.size(); i++) {
                distribuicoesArray[i] = distribuicoes.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 distribuicoesArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) DistribuicaoDTO(com.tomasio.projects.trainning.dto.DistribuicaoDTO) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Distribuicao(com.tomasio.projects.trainning.model.Distribuicao) DistribuicaoDAO(com.tomasio.projects.trainning.dao.DistribuicaoDAO) 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

DistribuicaoDAO (com.tomasio.projects.trainning.dao.DistribuicaoDAO)9 DAOException (com.tomasio.projects.trainning.exception.DAOException)9 Distribuicao (com.tomasio.projects.trainning.model.Distribuicao)9 Transactional (org.springframework.transaction.annotation.Transactional)8 CoreException (com.tomasio.projects.trainning.exeption.CoreException)6 ParseException (java.text.ParseException)6 OrganizacaoDAO (com.tomasio.projects.trainning.dao.OrganizacaoDAO)3 DistribuicaoDTO (com.tomasio.projects.trainning.dto.DistribuicaoDTO)3 FaseDTO (com.tomasio.projects.trainning.dto.FaseDTO)2 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)2 Organizacao (com.tomasio.projects.trainning.model.Organizacao)2 BigDecimal (java.math.BigDecimal)2 DateTime (org.joda.time.DateTime)2 Days (org.joda.time.Days)2 HibernateDistribuicaoDAO (com.tomasio.projects.trainning.dao.HibernateDistribuicaoDAO)1 HibernateOrganizacaoDAO (com.tomasio.projects.trainning.dao.HibernateOrganizacaoDAO)1 ExternoDTO (com.tomasio.projects.trainning.dto.ExternoDTO)1 HashMap (java.util.HashMap)1