Search in sources :

Example 1 with DAOException

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

the class SystemServiceSimpleImpl method findAllAnotacoesByUser.

@Override
@Transactional(readOnly = true)
public AnotacaoDTO[] findAllAnotacoesByUser(String user) {
    AnotacaoDAO dao = factory.getAnotacaoDAO();
    AnotacaoDTO[] anotacoesArray = null;
    try {
        List<AnotacaoDTO> anotacoes = dao.findAllByUser(user);
        if (anotacoes != null) {
            anotacoesArray = new AnotacaoDTO[anotacoes.size()];
            anotacoes.toArray(anotacoesArray);
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return anotacoesArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) AnotacaoDTO(com.tomasio.projects.trainning.dto.AnotacaoDTO) AnotacaoDAO(com.tomasio.projects.trainning.dao.AnotacaoDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with DAOException

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

the class SystemServiceSimpleImpl method createAnotacao.

@Override
@Transactional
public Long createAnotacao(AnotacaoDTO anotacao) {
    AnotacaoDAO dao = factory.getAnotacaoDAO();
    Long id = null;
    try {
        id = dao.create(anotacao);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return id;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) AnotacaoDAO(com.tomasio.projects.trainning.dao.AnotacaoDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with DAOException

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

the class SystemServiceSimpleImpl method findAllLogByObjectId.

@Override
@Transactional(readOnly = true)
public LogDTO[] findAllLogByObjectId(String objectId) {
    LogDAO dao = factory.getLogDAO();
    LogDTO[] logsArray = null;
    try {
        List<LogDTO> logs = dao.findAllByObjectId(objectId);
        if (logs != null) {
            logsArray = new LogDTO[logs.size()];
            logs.toArray(logsArray);
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return logsArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) LogDAO(com.tomasio.projects.trainning.dao.LogDAO) CoreException(com.tomasio.projects.trainning.exeption.CoreException) LogDTO(com.tomasio.projects.trainning.dto.LogDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with DAOException

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

the class TeachingDocumentsServiceSimpleImpl method findAbreviatura.

@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public AbreviaturaDTO findAbreviatura(Long id) {
    AbreviaturaDAO dao = factory.getAbreviaturaDAO();
    Abreviatura abreviatura = null;
    try {
        abreviatura = 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 (abreviatura != null) {
        return abreviatura.createDTO();
    } else {
        return null;
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Abreviatura(com.tomasio.projects.trainning.model.Abreviatura) 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 5 with DAOException

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

the class TeachingDocumentsServiceSimpleImpl method updatePerfilRelacionamento.

@Override
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
@Transactional
public void updatePerfilRelacionamento(PerfilRelacionamentoDTO perfil) {
    PerfilRelacionamentoDAO dao = factory.getPerfilRelacionamentoDAO();
    PerfilRelacionamento model = new PerfilRelacionamento(perfil);
    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 : PerfilRelacionamento(com.tomasio.projects.trainning.model.PerfilRelacionamento) DAOException(com.tomasio.projects.trainning.exception.DAOException) 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