Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. private BooleanBuilder getQueryAgendamentosDeAgendaDisponiveisParaCancelamento(Long agendaId, String periodoFinal, Integer quantidadeVagaEletivoUrgencia) {
  2. Classificacao situacaoCancelada = classificacaoService.getClassificacaoByAtributo1(TipoClassificacao.AGENDAMENTO_SITUACAO, Agendamento.SITUACAO_CANCELADO);
  3. Classificacao situacaoFinalizada = classificacaoService.getClassificacaoByAtributo1(TipoClassificacao.AGENDAMENTO_SITUACAO, Agendamento.SITUACAO_FINALIZADO);
  4. BooleanBuilder periodoFinalFilter = new BooleanBuilder();
  5. BooleanBuilder qtdVagasEletivosUrgencia = new BooleanBuilder();
  6.  
  7. QAgendamento q = QAgendamento.agendamento;
  8. BooleanBuilder where = new BooleanBuilder(q.agenda().id.eq(agendaId));
  9.  
  10. if (quantidadeVagaEletivoUrgencia != null) {
  11. qtdVagasEletivosUrgencia = new BooleanBuilder(q.posicaoFinal.goe(quantidadeVagaEletivoUrgencia));
  12. }
  13.  
  14. if (periodoFinal != null) {
  15. LocalDate periodoFinalParsed = LocalDate.parse(periodoFinal);
  16. periodoFinalFilter = new BooleanBuilder(q.dataAgendamento.goe(periodoFinalParsed));
  17. }
  18.  
  19. where.and(q.classificacaoSituacao().id.notIn(situacaoCancelada.getId(), situacaoFinalizada.getId()));
  20. where.and(periodoFinalFilter).and(q.inativo.ne(Boolean.TRUE).and(qtdVagasEletivosUrgencia));
  21. teste(where);
  22. return where;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement