Search in sources :

Example 11 with DAOException

use of com.tomasio.projects.trainning.exception.DAOException in project trainning by fernandotomasio.

the class TeachingDocumentsServiceSimpleImpl method createNivelAprendizagem.

@Override
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
@Transactional
public Long createNivelAprendizagem(NivelAprendizagemDTO nivelAprendizagem) {
    NivelAprendizagemDAO dao = factory.getNivelAprendizagemDAO();
    NivelAprendizagem _nivelAprendizagem = new NivelAprendizagem(nivelAprendizagem);
    Long id = null;
    try {
        id = dao.createNivelAprendizagem(_nivelAprendizagem);
    } catch (DAOException ex) {
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        throw new CoreException("Erro de sistema: " + ex.getMessage());
    }
    return id;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) NivelAprendizagem(com.tomasio.projects.trainning.model.NivelAprendizagem) CoreException(com.tomasio.projects.trainning.exeption.CoreException) DAOException(com.tomasio.projects.trainning.exception.DAOException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 12 with DAOException

use of com.tomasio.projects.trainning.exception.DAOException in project trainning by fernandotomasio.

the class TeachingDocumentsServiceSimpleImpl method createAreaConhecimento.

@Override
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
@Transactional
public Long createAreaConhecimento(AreaEnsinoDTO areaConhecimento) {
    AreaConhecimentoDAO dao = factory.getAreaConhecimentoDAO();
    AreaEnsino _areaEnsino = new AreaEnsino(areaConhecimento);
    Long id = null;
    try {
        id = dao.createAreaConhecimento(_areaEnsino);
    } catch (DAOException ex) {
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        throw new CoreException("Erro de sistema: " + ex.getMessage());
    }
    return id;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) AreaEnsino(com.tomasio.projects.trainning.model.AreaEnsino) CoreException(com.tomasio.projects.trainning.exeption.CoreException) DAOException(com.tomasio.projects.trainning.exception.DAOException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 13 with DAOException

use of com.tomasio.projects.trainning.exception.DAOException in project trainning by fernandotomasio.

the class TeachingDocumentsServiceSimpleImpl method createApostila.

@Override
@Transactional
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public Long createApostila(ApostilaDTO apostila) {
    ApostilaDAO dao = factory.getApostilaDAO();
    ContentDAO contentDAO = factory.getContentDAO();
    String documentsRoot = "SGC/Material Didático/Apostilas";
    Apostila model = new Apostila(apostila);
    Long id = null;
    try {
        id = dao.create(model);
        model = dao.find(id);
        String folderName = apostila.getDisciplina().getCurriculoMinimo().getCurso().getCodigo() + "_" + model.getId() + "_" + apostila.getDisciplina().getNumeroGeral() + "_" + apostila.getDisciplina().getDescricao();
        String finalPath = documentsRoot + "/" + folderName;
        if (contentDAO.contentExistsByPath(finalPath) == false) {
            FolderDTO folder = new FolderDTO();
            folder.setName(folderName);
            String folderId = contentDAO.createFolder(folder, documentsRoot);
            FolderDTO assetsFolder = new FolderDTO();
            assetsFolder.setName("assets");
            String assetsFolderId = contentDAO.createFolderWithUUIDParent(assetsFolder, folderId);
            model.setAssetsFolderId(assetsFolderId);
            model.setFolderId(folderId);
            dao.update(model);
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    } catch (Exception ex) {
        throw new CoreException("Erro de sistema: " + ex.getMessage());
    }
    return id;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) FolderDTO(com.tomasio.projects.trainning.dto.FolderDTO) CoreException(com.tomasio.projects.trainning.exeption.CoreException) AnexoApostila(com.tomasio.projects.trainning.model.AnexoApostila) Apostila(com.tomasio.projects.trainning.model.Apostila) CapituloApostila(com.tomasio.projects.trainning.model.CapituloApostila) SecaoApostila(com.tomasio.projects.trainning.model.SecaoApostila) CoreException(com.tomasio.projects.trainning.exeption.CoreException) DAOException(com.tomasio.projects.trainning.exception.DAOException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 14 with DAOException

use of com.tomasio.projects.trainning.exception.DAOException in project trainning by fernandotomasio.

the class TeachingDocumentsServiceSimpleImpl method updateUnidadeDidatica.

@Override
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
@Transactional
public void updateUnidadeDidatica(UnidadeDidaticaDTO unidade) {
    UnidadeDidaticaDAO dao = factory.getUnidadeDidaticaDAO();
    UnidadeDidatica model = new UnidadeDidatica(unidade);
    try {
        dao.update(model);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    } catch (Exception ex) {
        throw new CoreException("Erro de sistema: " + ex.getMessage());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) ObjetivoUnidadeDidatica(com.tomasio.projects.trainning.model.ObjetivoUnidadeDidatica) UnidadeDidatica(com.tomasio.projects.trainning.model.UnidadeDidatica) CoreException(com.tomasio.projects.trainning.exeption.CoreException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) DAOException(com.tomasio.projects.trainning.exception.DAOException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 15 with DAOException

use of com.tomasio.projects.trainning.exception.DAOException in project trainning by fernandotomasio.

the class TeachingDocumentsServiceSimpleImpl method findConceituacao.

@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public ConceituacaoDTO findConceituacao(Long id) {
    ConceituacaoDAO dao = factory.getConceituacaoDAO();
    Conceituacao conceituacao = null;
    try {
        conceituacao = dao.find(id);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    } catch (Exception ex) {
        throw new CoreException("Erro de sistema: " + ex.getMessage());
    }
    if (conceituacao != null) {
        return conceituacao.createDTO();
    } else {
        return null;
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Conceituacao(com.tomasio.projects.trainning.model.Conceituacao) CoreException(com.tomasio.projects.trainning.exeption.CoreException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) DAOException(com.tomasio.projects.trainning.exception.DAOException) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

DAOException (com.tomasio.projects.trainning.exception.DAOException)643 CoreException (com.tomasio.projects.trainning.exeption.CoreException)388 Transactional (org.springframework.transaction.annotation.Transactional)385 HibernateException (org.hibernate.HibernateException)186 Session (org.hibernate.Session)186 ParseException (java.text.ParseException)112 Organizacao (com.tomasio.projects.trainning.model.Organizacao)77 ArrayList (java.util.ArrayList)57 Criteria (org.hibernate.Criteria)51 Pessoa (com.tomasio.projects.trainning.model.Pessoa)46 IndicacaoDAO (com.tomasio.projects.trainning.dao.IndicacaoDAO)37 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)37 TurmaEfetiva (com.tomasio.projects.trainning.model.TurmaEfetiva)33 PreMatriculaDAO (com.tomasio.projects.trainning.dao.PreMatriculaDAO)32 PreMatricula (com.tomasio.projects.trainning.model.PreMatricula)30 StatusTurmaEfetiva (com.tomasio.projects.trainning.model.StatusTurmaEfetiva)30 Matricula (com.tomasio.projects.trainning.model.Matricula)29 SimpleDateFormat (java.text.SimpleDateFormat)28 MatriculaDAO (com.tomasio.projects.trainning.dao.MatriculaDAO)26 TurmaDAO (com.tomasio.projects.trainning.dao.TurmaDAO)26