use of com.tomasio.projects.trainning.model.Conclusao in project trainning by fernandotomasio.
the class HibernateConclusaoDAO method findAllConcluidos.
@Override
public List<Conclusao> findAllConcluidos(Long[] organizacoesId, Long capacitacaoId, Long turmaId, Long pessoaId, boolean aproveitamento) throws DAOException {
Session session = sessionFactory.getCurrentSession();
try {
Criteria criteria = session.createCriteria(Conclusao.class);
criteria.createAlias("capacitacao", "c");
criteria.createAlias("pessoa", "p");
criteria.createAlias("p.organizacao", "o");
if (organizacoesId != null) {
criteria = criteria.add(Restrictions.in("o.id", organizacoesId));
}
if (capacitacaoId != null) {
criteria = criteria.add(Restrictions.eq("c.id", capacitacaoId));
}
if (turmaId != null && turmaId > 0) {
criteria.createAlias("matricula", "m");
criteria.createAlias("m.turma", "t");
criteria = criteria.add(Restrictions.eq("t.id", turmaId));
}
if (pessoaId != null) {
criteria = criteria.add(Restrictions.eq("p.id", pessoaId));
}
criteria = criteria.add(Restrictions.eq("comAproveitamento", aproveitamento));
@SuppressWarnings("unchecked") List<Conclusao> conclusoes = criteria.list();
return conclusoes;
} catch (HibernateException ex) {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
throw new DAOException(MessageHelper.getMessage("conclusoes.list.error"));
}
}
use of com.tomasio.projects.trainning.model.Conclusao in project trainning by fernandotomasio.
the class HibernateConclusaoDAO method findAllConcluidosTurmasOresp.
@Override
public List<Conclusao> findAllConcluidosTurmasOresp(Long organizacaoRespId, Date exercicio, boolean aproveitamento, String searchTerm) throws DAOException {
SimpleDateFormat dfYear = new SimpleDateFormat("yyyy");
Session session = sessionFactory.getCurrentSession();
if (exercicio != null) {
try {
exercicio = dfYear.parse(dfYear.format(exercicio));
} catch (ParseException ex) {
Logger.getLogger(HibernateTurmaDAO.class.getName()).log(Level.SEVERE, null, ex);
}
}
try {
Criteria criteria = session.createCriteria(Conclusao.class);
criteria.createAlias("matricula", "m");
criteria.createAlias("m.turma", "t");
criteria.createAlias("t.curso", "c");
if (exercicio != null) {
criteria.add(Restrictions.eq("t.exercicio", exercicio));
}
if (organizacaoRespId != null && organizacaoRespId > 0L) {
criteria.add(Restrictions.eq("t.responsavelId", organizacaoRespId));
}
if (searchTerm != null && !searchTerm.equals("")) {
Disjunction or = Restrictions.disjunction();
or.add(Restrictions.ilike("c.codigo", "%" + searchTerm + "%")).add(Restrictions.ilike("c.descricao", "%" + searchTerm + "%"));
criteria.add(or);
}
criteria = criteria.add(Restrictions.eq("comAproveitamento", aproveitamento));
criteria.addOrder(Order.asc("c.codigo"));
criteria.addOrder(Order.asc("t.numeroTurma"));
@SuppressWarnings("unchecked") List<Conclusao> conclusoes = criteria.list();
return conclusoes;
} catch (HibernateException ex) {
Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
throw new DAOException(MessageHelper.getMessage("conclusoes.list.error"));
}
}
use of com.tomasio.projects.trainning.model.Conclusao in project trainning by fernandotomasio.
the class AtividadesEnsinoServiceSimpleImpl method findAllConcluidosByOrganizacao.
@Override
@Transactional(readOnly = true)
public ConclusaoDTO[] findAllConcluidosByOrganizacao(Long organizacaoId, Long capacitacaoId, boolean aproveitamento) {
ConclusaoDAO dao = factory.getConclusaoDAO();
ConclusaoDTO[] concluidosArray = null;
try {
List<Conclusao> concluidos = dao.findAllConcluidosByOrganizacao(organizacaoId, capacitacaoId, aproveitamento);
concluidosArray = new ConclusaoDTO[concluidos.size()];
for (int i = 0; i < concluidosArray.length; i++) {
concluidosArray[i] = concluidos.get(i).createDTO();
}
return concluidosArray;
} catch (DAOException ex) {
Logger.getLogger(AtividadesEnsinoServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
throw new CoreException(ex.getMessage());
}
}
use of com.tomasio.projects.trainning.model.Conclusao in project trainning by fernandotomasio.
the class AtividadesEnsinoServiceSimpleImpl method findAllConcluidosByTurma.
@Override
@Transactional(readOnly = true)
public ConclusaoDTO[] findAllConcluidosByTurma(Long turmaId, boolean aproveitamento) {
ConclusaoDAO dao = factory.getConclusaoDAO();
ConclusaoDTO[] concluidosArray = null;
try {
List<Conclusao> concluidos = dao.findAllconcluidosByTurma(turmaId, aproveitamento);
concluidosArray = new ConclusaoDTO[concluidos.size()];
for (int i = 0; i < concluidosArray.length; i++) {
concluidosArray[i] = concluidos.get(i).createDTO();
}
return concluidosArray;
} catch (DAOException ex) {
Logger.getLogger(AtividadesEnsinoServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
throw new CoreException(ex.getMessage());
}
}
use of com.tomasio.projects.trainning.model.Conclusao in project trainning by fernandotomasio.
the class AtividadesEnsinoServiceSimpleImpl method updateConclusao.
@Override
@Transactional
public void updateConclusao(ConclusaoDTO conclusao) {
ConclusaoDAO dao = factory.getConclusaoDAO();
Conclusao _conclusao = new Conclusao(conclusao);
try {
dao.update(_conclusao);
} catch (DAOException ex) {
Logger.getLogger(AtividadesEnsinoServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
throw new CoreException(ex.getMessage());
}
}
Aggregations