Java Code Examples for org.apache.nifi.provenance.search.Query#getEndDate()
The following examples show how to use
org.apache.nifi.provenance.search.Query#getEndDate() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LatestEventsQuery.java From localization_nifi with Apache License 2.0 | 6 votes |
@Override public Optional<List<Long>> evaluate(final Query query) { if (latestRecords.getSize() < query.getMaxResults()) { return Optional.empty(); } if (query.getSearchTerms().isEmpty() && query.getStartDate() == null && query.getEndDate() == null) { final List<Long> eventList = latestRecords.asList(); if (eventList.size() > query.getMaxResults()) { return Optional.of(eventList.subList(0, query.getMaxResults())); } else { return Optional.of(eventList); } } else { return Optional.empty(); } }
Example 2
Source File: LatestEventsQuery.java From nifi with Apache License 2.0 | 6 votes |
@Override public Optional<List<Long>> evaluate(final Query query) { if (latestRecords.getSize() < query.getMaxResults()) { return Optional.empty(); } if (query.getSearchTerms().isEmpty() && query.getStartDate() == null && query.getEndDate() == null) { final List<Long> eventList = latestRecords.asList(); if (eventList.size() > query.getMaxResults()) { return Optional.of(eventList.subList(0, query.getMaxResults())); } else { return Optional.of(eventList); } } else { return Optional.empty(); } }
Example 3
Source File: LatestEventsPerProcessorQuery.java From localization_nifi with Apache License 2.0 | 5 votes |
@Override public Optional<List<Long>> evaluate(final Query query) { if (query.getMaxResults() > 1000) { // If query max results > 1000 then we know we don't have enough results. So just return empty. return Optional.empty(); } final List<SearchTerm> terms = query.getSearchTerms(); if (terms.size() != 1) { return Optional.empty(); } final SearchTerm term = terms.get(0); if (!COMPONENT_ID_FIELD_NAME.equals(term.getSearchableField().getSearchableFieldName())) { return Optional.empty(); } if (query.getEndDate() != null || query.getStartDate() != null) { return Optional.empty(); } final RingBuffer<Long> ringBuffer = latestRecords.get(term.getValue()); if (ringBuffer == null || ringBuffer.getSize() < query.getMaxResults()) { return Optional.empty(); } List<Long> eventIds = ringBuffer.asList(); if (eventIds.size() > query.getMaxResults()) { eventIds = eventIds.subList(0, query.getMaxResults()); } return Optional.of(eventIds); }
Example 4
Source File: LuceneEventIndex.java From localization_nifi with Apache License 2.0 | 5 votes |
private void validate(final Query query) { final int numQueries = querySubmissionMap.size(); if (numQueries > MAX_UNDELETED_QUERY_RESULTS) { throw new IllegalStateException("Cannot process query because there are currently " + numQueries + " queries whose results have not " + "been deleted due to poorly behaving clients not issuing DELETE requests. Please try again later."); } if (query.getEndDate() != null && query.getStartDate() != null && query.getStartDate().getTime() > query.getEndDate().getTime()) { throw new IllegalArgumentException("Query End Time cannot be before Query Start Time"); } }
Example 5
Source File: LatestEventsPerProcessorQuery.java From nifi with Apache License 2.0 | 5 votes |
@Override public Optional<List<Long>> evaluate(final Query query) { if (query.getMaxResults() > 1000) { // If query max results > 1000 then we know we don't have enough results. So just return empty. return Optional.empty(); } final List<SearchTerm> terms = query.getSearchTerms(); if (terms.size() != 1) { return Optional.empty(); } final SearchTerm term = terms.get(0); if (!COMPONENT_ID_FIELD_NAME.equals(term.getSearchableField().getSearchableFieldName())) { return Optional.empty(); } if (query.getEndDate() != null || query.getStartDate() != null) { return Optional.empty(); } final RingBuffer<Long> ringBuffer = latestRecords.get(term.getValue()); if (ringBuffer == null || ringBuffer.getSize() < query.getMaxResults()) { return Optional.empty(); } List<Long> eventIds = ringBuffer.asList(); if (eventIds.size() > query.getMaxResults()) { eventIds = eventIds.subList(0, query.getMaxResults()); } return Optional.of(eventIds); }
Example 6
Source File: LuceneEventIndex.java From nifi with Apache License 2.0 | 5 votes |
private void validate(final Query query) { final int numQueries = querySubmissionMap.size(); if (numQueries > MAX_UNDELETED_QUERY_RESULTS) { purgeObsoleteQueries(); if (querySubmissionMap.size() > MAX_UNDELETED_QUERY_RESULTS) { throw new IllegalStateException("Cannot process query because there are currently " + numQueries + " queries whose results have not " + "been deleted due to poorly behaving clients not issuing DELETE requests. Please try again later."); } } if (query.getEndDate() != null && query.getStartDate() != null && query.getStartDate().getTime() > query.getEndDate().getTime()) { throw new IllegalArgumentException("Query End Time cannot be before Query Start Time"); } }