use of com.tomasio.projects.trainning.model.ComplementacaoInstrucao in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method findComplementacaoInstrucao.
@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public ComplementacaoInstrucaoDTO findComplementacaoInstrucao(Long id) {
ComplementacaoInstrucaoDAO dao = factory.getComplementacaoInstrucaoDAO();
ComplementacaoInstrucao complementacao = null;
try {
complementacao = 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 (complementacao != null) {
return complementacao.createDTO();
} else {
return null;
}
}
use of com.tomasio.projects.trainning.model.ComplementacaoInstrucao in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method findAllComplementacoesInstrucaoByPUD.
@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public ComplementacaoInstrucaoDTO[] findAllComplementacoesInstrucaoByPUD(Long pudId) {
ComplementacaoInstrucaoDAO dao = factory.getComplementacaoInstrucaoDAO();
ComplementacaoInstrucaoDTO[] complementacaosArray = null;
try {
List<ComplementacaoInstrucao> complementacaos = dao.findAll(pudId);
complementacaosArray = new ComplementacaoInstrucaoDTO[complementacaos.size()];
for (int i = 0; i < complementacaosArray.length; i++) {
complementacaosArray[i] = complementacaos.get(i).createDTO();
}
} 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.toString());
}
return complementacaosArray;
}
use of com.tomasio.projects.trainning.model.ComplementacaoInstrucao in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method updateComplementacaoInstrucao.
@Override
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
@Transactional
public void updateComplementacaoInstrucao(ComplementacaoInstrucaoDTO complementacao) {
ComplementacaoInstrucaoDAO dao = factory.getComplementacaoInstrucaoDAO();
ComplementacaoInstrucao model = new ComplementacaoInstrucao(complementacao);
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());
}
}
use of com.tomasio.projects.trainning.model.ComplementacaoInstrucao in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method createComplementacaoInstrucao.
@Override
@Transactional
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public Long createComplementacaoInstrucao(ComplementacaoInstrucaoDTO complementacao) {
ComplementacaoInstrucaoDAO dao = factory.getComplementacaoInstrucaoDAO();
ComplementacaoInstrucao model = new ComplementacaoInstrucao(complementacao);
Long id = null;
try {
id = dao.create(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;
}
use of com.tomasio.projects.trainning.model.ComplementacaoInstrucao in project trainning by fernandotomasio.
the class HibernateComplementacaoInstrucaoDAO method findAll.
@Override
public List<ComplementacaoInstrucao> findAll(Long pudId) throws DAOException {
Session session = sessionFactory.getCurrentSession();
try {
Criteria criteria = session.createCriteria(ComplementacaoInstrucao.class);
criteria.add(Restrictions.eq("curriculoMinimo.id", pudId));
criteria.addOrder(Order.asc("numero"));
@SuppressWarnings("unchecked") List<ComplementacaoInstrucao> complementacoes = criteria.list();
return complementacoes;
} catch (HibernateException e) {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("complementacoes.find.list.error"));
}
}
Aggregations