Search in sources :

Example 1 with Plano

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

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

use of com.tomasio.projects.trainning.model.Plano 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 4 with Plano

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

the class TrainningServiceSimpleImpl method searchPlanoBySigla.

@Override
@Transactional(readOnly = true)
public PlanoDTO[] searchPlanoBySigla(String term) {
    PlanoDAO dao = factory.getPlanoDAO();
    PlanoDTO[] planosArray = null;
    try {
        List<Plano> planos = dao.searchBySigla(term);
        if (planos != null) {
            planosArray = new PlanoDTO[planos.size()];
            for (int i = 0; i < planos.size(); i++) {
                planosArray[i] = planos.get(i).createDTOWithoutDependencies();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return planosArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) PlanoDTO(com.tomasio.projects.trainning.dto.PlanoDTO) Plano(com.tomasio.projects.trainning.model.Plano) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with Plano

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

the class TrainningServiceSimpleImpl method searchPlanoByDescricao.

@Override
@Transactional(readOnly = true)
public PlanoDTO[] searchPlanoByDescricao(String term) {
    PlanoDAO dao = factory.getPlanoDAO();
    PlanoDTO[] planosArray = null;
    try {
        List<Plano> planos = dao.searchByDescricao(term);
        if (planos != null) {
            planosArray = new PlanoDTO[planos.size()];
            for (int i = 0; i < planos.size(); i++) {
                planosArray[i] = planos.get(i).createDTOWithoutDependencies();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return planosArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PlanoDAO(com.tomasio.projects.trainning.dao.PlanoDAO) PlanoDTO(com.tomasio.projects.trainning.dto.PlanoDTO) Plano(com.tomasio.projects.trainning.model.Plano) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

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