Search in sources :

Example 1 with PlanoDAO

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

the class TrainningServiceSimpleImpl method updatePlano.

@Override
@Transactional
public void updatePlano(PlanoDTO planoDTO) {
    PlanoDAO dao = factory.getPlanoDAO();
    Plano model = new Plano();
    assemblyEntity(planoDTO, model);
    try {
        dao.update(model);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) Plano(com.tomasio.projects.trainning.model.Plano) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with PlanoDAO

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

the class TrainningServiceSimpleImpl method createPlano.

@Override
@Transactional
public Long createPlano(PlanoDTO plano) {
    PlanoDAO dao = factory.getPlanoDAO();
    Plano model = new Plano();
    assemblyEntity(plano, model);
    return create(dao, model);
}
Also used : PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) Plano(com.tomasio.projects.trainning.model.Plano) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with PlanoDAO

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

the class TrainningServiceSimpleImpl method removePlano.

@Override
@Transactional
public void removePlano(Long id) {
    PlanoDAO dao = factory.getPlanoDAO();
    remove(dao, id);
}
Also used : PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with PlanoDAO

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

the class AtividadesEnsinoServiceSimpleImpl method findAllPlanos.

@Override
@Transactional(readOnly = true)
public PlanoDTO[] findAllPlanos() {
    PlanoDAO dao = factory.getPlanoDAO();
    List<Plano> planos;
    PlanoDTO[] planosArray = null;
    try {
        planos = dao.findAll();
        planosArray = new PlanoDTO[planos.size()];
        for (int i = 0; i < planos.size(); i++) {
            planosArray[i] = planos.get(i).createDTOWithoutDependencies();
        }
        return planosArray;
    } catch (DAOException ex) {
        ex.printStackTrace();
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new CoreException(ex.getMessage());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) DAOException(com.tomasio.projects.trainning.exception.DAOException) ParseException(java.text.ParseException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Plano(com.tomasio.projects.trainning.model.Plano) PlanoDTO(com.tomasio.projects.trainning.dto.PlanoDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with PlanoDAO

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

the class AtividadesEnsinoServiceSimpleImpl method findAllOrganizacoesHasPlano.

@Override
@Transactional(readOnly = true)
public OrganizacaoDTO[] findAllOrganizacoesHasPlano() {
    PlanoDAO dao = factory.getPlanoDAO();
    List<OrganizacaoDTO> organizacoes;
    OrganizacaoDTO[] organizacoesArray = null;
    try {
        organizacoes = dao.findAllOrganizacoesHasPlano();
        organizacoesArray = new OrganizacaoDTO[organizacoes.size()];
        for (int i = 0; i < organizacoes.size(); i++) {
            organizacoesArray[i] = organizacoes.get(i);
        }
        return organizacoesArray;
    } catch (DAOException ex) {
        ex.printStackTrace();
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new CoreException(ex.getMessage());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) 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

PlanoDAO (com.tomasio.projects.trainning.dao.PlanoDAO)11 Transactional (org.springframework.transaction.annotation.Transactional)10 Plano (com.tomasio.projects.trainning.model.Plano)8 PlanoDTO (com.tomasio.projects.trainning.dto.PlanoDTO)6 DAOException (com.tomasio.projects.trainning.exception.DAOException)6 CoreException (com.tomasio.projects.trainning.exeption.CoreException)6 ParseException (java.text.ParseException)2 DAOFactory (com.tomasio.projects.trainning.dao.DAOFactory)1 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1