dsl.and(ZIPKIN_SPANS.DURATION.between(request.minDuration, request.maxDuration)); } else if (request.minDuration != null){ dsl.and(ZIPKIN_SPANS.DURATION.greaterOrEqual(request.minDuration));
dsl.and(ZIPKIN_SPANS.DURATION.between(request.minDuration, request.maxDuration)); } else if (request.minDuration != null) { dsl.and(ZIPKIN_SPANS.DURATION.greaterOrEqual(request.minDuration));
dsl.and(ZIPKIN_SPANS.DURATION.between(request.minDuration, request.maxDuration)); } else if (request.minDuration != null) { dsl.and(ZIPKIN_SPANS.DURATION.greaterOrEqual(request.minDuration));
conditions.add(Tables.PAGEVIEW.NUM_VIEWS.greaterOrEqual(pDaoFilter.getMinNumViews())); conditions.add(Tables.PAGEVIEW.TSTAMP.greaterOrEqual(new Timestamp(pDaoFilter.getStartDate().getMillis())));
conditions.add(Tables.PAGEVIEW.NUM_VIEWS.greaterOrEqual(pDaoFilter.getMinNumViews())); conditions.add(Tables.PAGEVIEW.TSTAMP.greaterOrEqual(new Timestamp(pDaoFilter.getStartDate().getMillis())));
public Map<String, List<ProjectProcesses>> processByOrgs(int maxProjectRows, Set<UUID> orgIds, Set<ProcessStatus> processStatuses, Timestamp fromUpdatedAt) { Set<String> statuses = processStatuses.stream().map(Enum::name).collect(Collectors.toSet()); try (DSLContext tx = DSL.using(cfg)) { WindowRowsStep<Integer> rnField = rowNumber().over().partitionBy(V_PROCESS_QUEUE.ORG_NAME).orderBy(V_PROCESS_QUEUE.ORG_NAME); SelectHavingStep<Record4<String, String, Integer, Integer>> a = tx.select(V_PROCESS_QUEUE.ORG_NAME, V_PROCESS_QUEUE.PROJECT_NAME, count(), rnField) .from(V_PROCESS_QUEUE) .where(V_PROCESS_QUEUE.ORG_ID.in(orgIds) .and(V_PROCESS_QUEUE.CURRENT_STATUS.in(statuses)) .and(V_PROCESS_QUEUE.LAST_UPDATED_AT.greaterOrEqual(fromUpdatedAt))) .groupBy(V_PROCESS_QUEUE.ORG_NAME, V_PROCESS_QUEUE.PROJECT_NAME); Result<Record3<String, String, Integer>> r = tx.select(a.field(0, String.class), a.field(1, String.class), a.field(2, Integer.class)) .from(a) .where(a.field(rnField).lessOrEqual(maxProjectRows)) .fetch(); Map<String, List<ProjectProcesses>> result = new HashMap<>(); r.forEach(i -> { String orgName = i.value1(); String projectName = i.value2(); int count = i.value3(); result.computeIfAbsent(orgName, (k) -> new ArrayList<>()).add(new ProjectProcesses(projectName, count)); }); return result; } } }
dsl.and(ZIPKIN_SPANS.DURATION.between(request.minDuration, request.maxDuration)); } else if (request.minDuration != null) { dsl.and(ZIPKIN_SPANS.DURATION.greaterOrEqual(request.minDuration));
public List<ProcessStatusHistoryEntry> getHistory(ProcessKey processKey) { try (DSLContext tx = DSL.using(cfg)) { ProcessEvents pe = PROCESS_EVENTS.as("pe"); return tx.select(historyEntryToJsonb(pe)) .from(pe) .where(pe.INSTANCE_ID.eq(processKey.getInstanceId()) .and(pe.INSTANCE_CREATED_AT.eq(processKey.getCreatedAt())) .and(pe.EVENT_TYPE.eq(EventType.PROCESS_STATUS.name()) .and(pe.EVENT_DATE.greaterOrEqual(processKey.getCreatedAt())))) .fetch(r -> deserialize(r.value1(), STATUS_HISTORY_ENTRY)); } }
.from(V_PROCESS_QUEUE) .where(V_PROCESS_QUEUE.INITIATOR_ID.eq(initiatorId) .and(V_PROCESS_QUEUE.LAST_UPDATED_AT.greaterOrEqual(fromUpdatedAt)) .and(or(V_PROCESS_QUEUE.PROJECT_ID.in(projectIds), V_PROCESS_QUEUE.PROJECT_ID.isNull())));
public List<EventItem> list(DSLContext tx, EventMarker marker, int count) { ProcessEvents pe = PROCESS_EVENTS.as("pe"); SelectConditionStep<Record9<UUID, Timestamp, Long, Timestamp, String, String, String, Long, Boolean>> q = tx.select( pe.INSTANCE_ID, pe.INSTANCE_CREATED_AT, pe.EVENT_SEQ, pe.EVENT_DATE, field("{0}->>'host'", String.class, pe.EVENT_DATA), coalesce(field("{0}->>'hostGroup'", String.class, pe.EVENT_DATA), value("-")), field("{0}->>'status'", String.class, pe.EVENT_DATA), coalesce(field("{0}->>'duration'", Long.class, pe.EVENT_DATA), value("0")), coalesce(field("{0}->>'ignore_errors'", Boolean.class, pe.EVENT_DATA), value("false"))) .from(pe) .where(pe.EVENT_TYPE.eq(EventType.ANSIBLE.name())); if (marker != null) { q.and(pe.EVENT_DATE.greaterOrEqual(marker.eventDate())) .and(pe.INSTANCE_CREATED_AT.greaterOrEqual(marker.startFrom()) .and(pe.EVENT_SEQ.greaterThan(marker.eventSeq()))); if (marker.endTo() != null) { q.and(pe.INSTANCE_CREATED_AT.lessThan(marker.endTo())); } } return q.orderBy(pe.EVENT_SEQ) .limit(count) .fetch(AnsibleEventDao::toEntity); }
public List<ProcessEntry> poll(PollEntry entry, Field<Timestamp> maxAge, int maxEntries) { ProcessQueue q = PROCESS_QUEUE.as("q"); return txResult(tx -> tx.select(q.INSTANCE_ID, q.CREATED_AT, q.PROJECT_ID, q.INITIATOR_ID) .from(q) .where(q.PROCESS_KIND.in(Utils.toString(HANDLED_PROCESS_KINDS)) .and(q.CURRENT_STATUS.eq(entry.status.toString())) .and(q.CREATED_AT.greaterOrEqual(maxAge)) .and(PgUtils.contains(q.HANDLERS, new String[]{entry.flow})) .and(noSuccessfulHandlers(q.INSTANCE_ID, entry.handlerKind)) .and(count(tx, q.INSTANCE_ID, entry.handlerKind).lessThan(entry.maxTries)) .and(noRunningHandlers(q.INSTANCE_ID))) .limit(maxEntries) .fetch(WatchdogDao::toEntry)); }
.and(PROCESS_QUEUE.CREATED_AT.eq(pe.INSTANCE_CREATED_AT)) .and(pe.EVENT_TYPE.eq(EventType.PROCESS_STATUS.name()) .and(pe.EVENT_DATE.greaterOrEqual(PROCESS_QUEUE.CREATED_AT)))) .asField("status_history"); query.addSelect(history);
inline("payload"), field("{0} - 'status'", Object.class, pe.EVENT_DATA)))))) .from(pe) .where(pq.INSTANCE_ID.eq(pe.INSTANCE_ID).and(pe.EVENT_TYPE.eq(EventType.PROCESS_STATUS.name()).and(pe.EVENT_DATE.greaterOrEqual(pq.CREATED_AT)))) .asField();