use of com.tomasio.projects.trainning.model.Abreviatura 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;
}
}
use of com.tomasio.projects.trainning.model.Abreviatura in project trainning by fernandotomasio.
the class HibernateAbreviaturaDAO method findAll.
@Override
public List<Abreviatura> findAll(Long pudId) throws DAOException {
Session session = sessionFactory.getCurrentSession();
try {
Criteria criteria = session.createCriteria(Abreviatura.class);
criteria.add(Restrictions.eq("curriculoMinimo.id", pudId));
criteria.addOrder(Order.asc("sigla"));
@SuppressWarnings("unchecked") List<Abreviatura> abreviaturas = criteria.list();
return abreviaturas;
} catch (HibernateException e) {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, e);
throw new DAOException(MessageHelper.getMessage("abreviaturas.find.list.error"));
}
}
use of com.tomasio.projects.trainning.model.Abreviatura in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method updateAbreviatura.
@Override
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
@Transactional
public void updateAbreviatura(AbreviaturaDTO abreviatura) {
AbreviaturaDAO dao = factory.getAbreviaturaDAO();
Abreviatura model = new Abreviatura(abreviatura);
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.Abreviatura in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method createAbreviatura.
@Override
@Transactional
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public Long createAbreviatura(AbreviaturaDTO abreviatura) {
AbreviaturaDAO dao = factory.getAbreviaturaDAO();
Abreviatura model = new Abreviatura(abreviatura);
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.Abreviatura in project trainning by fernandotomasio.
the class TeachingDocumentsServiceSimpleImpl method findAllAbreviaturasByPUD.
@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public AbreviaturaDTO[] findAllAbreviaturasByPUD(Long pudId) {
AbreviaturaDAO dao = factory.getAbreviaturaDAO();
AbreviaturaDTO[] abreviaturasArray = null;
try {
List<Abreviatura> abreviaturas = dao.findAll(pudId);
abreviaturasArray = new AbreviaturaDTO[abreviaturas.size()];
for (int i = 0; i < abreviaturasArray.length; i++) {
abreviaturasArray[i] = abreviaturas.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 abreviaturasArray;
}
Aggregations