Search in sources :

Example 71 with DAOException

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

the class OrganizationalServiceSimpleImpl method searchComandosBySigla.

@Override
@Transactional(readOnly = true)
public OrganizacaoDTO[] searchComandosBySigla(String term) {
    OrganizacaoDAO dao = factory.getOrganizacaoDAO();
    OrganizacaoDTO[] organizacoesArray = null;
    try {
        List<Organizacao> organizacoes = dao.searchComandoBySigla(term);
        if (organizacoes != null) {
            organizacoesArray = convertToArray(organizacoes);
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return organizacoesArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Organizacao(com.tomasio.projects.trainning.model.Organizacao) CoreException(com.tomasio.projects.trainning.exeption.CoreException) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 72 with DAOException

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

the class OrganizationalServiceSimpleImpl method findOrganizacao.

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

Example 73 with DAOException

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

the class MatriculasLoggerAdvice method logCreateMatricula.

@After("create()")
public void logCreateMatricula(JoinPoint joinPoint) {
    MatriculaDTO[] matriculas = (MatriculaDTO[]) joinPoint.getArgs()[0];
    if (matriculas != null && matriculas.length > 0) {
        try {
            LogDTO log = new LogDTO();
            log.setDataCriacao(new Date());
            log.setUser(getUser());
            for (MatriculaDTO matriculaDTO : matriculas) {
                String texto = "CRIAÇÃO DE MATRÍCULA " + getDetails(matriculaDTO);
                log.setTexto(texto);
                logger.create(log);
            }
        } catch (DAOException ex) {
            Logger.getLogger(MatriculasLoggerAdvice.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
Also used : MatriculaDTO(com.tomasio.projects.trainning.dto.MatriculaDTO) DAOException(com.tomasio.projects.trainning.exception.DAOException) LogDTO(com.tomasio.projects.trainning.dto.LogDTO) Date(java.util.Date) After(org.aspectj.lang.annotation.After)

Example 74 with DAOException

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

the class TrainningServiceLoggerAdvice method logUpdateCurso.

@After("update()")
public void logUpdateCurso(JoinPoint joinPoint) {
    CursoDAO dao = factory.getCursoDAO();
    CursoDTO curso = (CursoDTO) joinPoint.getArgs()[0];
    if (curso != null) {
        try {
            curso = dao.find(curso.getId()).createDTO();
            LogDTO log = new LogDTO();
            log.setDataCriacao(new Date());
            log.setUser(getUser());
            log.setObjectId(curso.getObjectId());
            String texto = "ATUALIZADO O CURSO " + getDetails(curso);
            log.setTexto(texto);
            logger.create(log);
        } catch (DAOException ex) {
            Logger.getLogger(TrainningServiceLoggerAdvice.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) LogDTO(com.tomasio.projects.trainning.dto.LogDTO) CursoDTO(com.tomasio.projects.trainning.dto.CursoDTO) CursoDAO(com.tomasio.projects.trainning.dao.CursoDAO) Date(java.util.Date) After(org.aspectj.lang.annotation.After)

Example 75 with DAOException

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

the class TeachingDocumentsServiceSimpleImpl method createDominioAprendizagem.

@Override
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
@Transactional
public Long createDominioAprendizagem(DominioAprendizagemDTO dominioAprendizagem) {
    NivelAprendizagemDAO dao = factory.getNivelAprendizagemDAO();
    DominioAprendizagem _dominio = new DominioAprendizagem(dominioAprendizagem);
    Long id = null;
    try {
        id = dao.createDominioAprendizagem(_dominio);
    } 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) DominioAprendizagem(com.tomasio.projects.trainning.model.DominioAprendizagem) 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