org.apache.nifi.provenance.search.Query.getEndDate()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(242)

本文整理了Java中org.apache.nifi.provenance.search.Query.getEndDate方法的一些代码示例,展示了Query.getEndDate的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getEndDate方法的具体详情如下:
包路径:org.apache.nifi.provenance.search.Query
类名称:Query
方法名:getEndDate

Query.getEndDate介绍

暂无

代码示例

代码示例来源:origin: apache/nifi

  1. private void validate(final Query query) {
  2. final int numQueries = querySubmissionMap.size();
  3. if (numQueries > MAX_UNDELETED_QUERY_RESULTS) {
  4. purgeObsoleteQueries();
  5. if (querySubmissionMap.size() > MAX_UNDELETED_QUERY_RESULTS) {
  6. throw new IllegalStateException("Cannot process query because there are currently " + numQueries + " queries whose results have not "
  7. + "been deleted due to poorly behaving clients not issuing DELETE requests. Please try again later.");
  8. }
  9. }
  10. if (query.getEndDate() != null && query.getStartDate() != null && query.getStartDate().getTime() > query.getEndDate().getTime()) {
  11. throw new IllegalArgumentException("Query End Time cannot be before Query Start Time");
  12. }
  13. }

代码示例来源:origin: apache/nifi

  1. @Override
  2. public Optional<List<Long>> evaluate(final Query query) {
  3. if (latestRecords.getSize() < query.getMaxResults()) {
  4. return Optional.empty();
  5. }
  6. if (query.getSearchTerms().isEmpty() && query.getStartDate() == null && query.getEndDate() == null) {
  7. final List<Long> eventList = latestRecords.asList();
  8. if (eventList.size() > query.getMaxResults()) {
  9. return Optional.of(eventList.subList(0, query.getMaxResults()));
  10. } else {
  11. return Optional.of(eventList);
  12. }
  13. } else {
  14. return Optional.empty();
  15. }
  16. }

代码示例来源:origin: apache/nifi

  1. @Override
  2. public QuerySubmission submitQuery(final Query query, final NiFiUser user) {
  3. if (query.getEndDate() != null && query.getStartDate() != null && query.getStartDate().getTime() > query.getEndDate().getTime()) {
  4. throw new IllegalArgumentException("Query End Time cannot be before Query Start Time");
  5. }
  6. final String userId = user == null ? null : user.getIdentity();
  7. if (query.getSearchTerms().isEmpty() && query.getStartDate() == null && query.getEndDate() == null) {
  8. final AsyncQuerySubmission result = new AsyncQuerySubmission(query, 1, userId);
  9. queryExecService.submit(new QueryRunnable(ringBuffer, createFilter(query, user), query.getMaxResults(), result));
  10. querySubmissionMap.put(query.getIdentifier(), result);
  11. return result;
  12. }
  13. final AsyncQuerySubmission result = new AsyncQuerySubmission(query, 1, userId);
  14. querySubmissionMap.put(query.getIdentifier(), result);
  15. queryExecService.submit(new QueryRunnable(ringBuffer, createFilter(query, user), query.getMaxResults(), result));
  16. return result;
  17. }

代码示例来源:origin: apache/nifi

  1. @Override
  2. public Optional<List<Long>> evaluate(final Query query) {
  3. if (query.getMaxResults() > 1000) {
  4. // If query max results > 1000 then we know we don't have enough results. So just return empty.
  5. return Optional.empty();
  6. }
  7. final List<SearchTerm> terms = query.getSearchTerms();
  8. if (terms.size() != 1) {
  9. return Optional.empty();
  10. }
  11. final SearchTerm term = terms.get(0);
  12. if (!COMPONENT_ID_FIELD_NAME.equals(term.getSearchableField().getSearchableFieldName())) {
  13. return Optional.empty();
  14. }
  15. if (query.getEndDate() != null || query.getStartDate() != null) {
  16. return Optional.empty();
  17. }
  18. final RingBuffer<Long> ringBuffer = latestRecords.get(term.getValue());
  19. if (ringBuffer == null || ringBuffer.getSize() < query.getMaxResults()) {
  20. return Optional.empty();
  21. }
  22. List<Long> eventIds = ringBuffer.asList();
  23. if (eventIds.size() > query.getMaxResults()) {
  24. eventIds = eventIds.subList(0, query.getMaxResults());
  25. }
  26. return Optional.of(eventIds);
  27. }

代码示例来源:origin: apache/nifi

  1. if (query.getEndDate() != null && query.getEndDate().getTime() < event.getEventTime()) {
  2. return false;

代码示例来源:origin: apache/nifi

  1. if (query.getEndDate() != null && query.getStartDate() != null && query.getStartDate().getTime() > query.getEndDate().getTime()) {
  2. throw new IllegalArgumentException("Query End Time cannot be before Query Start Time");
  3. if (query.getSearchTerms().isEmpty() && query.getStartDate() == null && query.getEndDate() == null) {
  4. final AsyncQuerySubmission result = new AsyncQuerySubmission(query, 1, userId);
  5. final List<File> indexDirectories = indexConfig.getIndexDirectories(
  6. query.getStartDate() == null ? null : query.getStartDate().getTime(),
  7. query.getEndDate() == null ? null : query.getEndDate().getTime());
  8. final AsyncQuerySubmission result = new AsyncQuerySubmission(query, indexDirectories.size(), userId);
  9. querySubmissionMap.put(query.getIdentifier(), result);

代码示例来源:origin: apache/nifi

  1. if (provenanceQuery.getEndDate() == null) {
  2. provenanceQuery.setEndDate(new Date());

代码示例来源:origin: apache/nifi

  1. public static org.apache.lucene.search.Query convertQuery(final org.apache.nifi.provenance.search.Query query) {
  2. if (query.getStartDate() == null && query.getEndDate() == null && query.getSearchTerms().isEmpty()) {
  3. return new MatchAllDocsQuery();
  4. }
  5. final BooleanQuery luceneQuery = new BooleanQuery();
  6. for (final SearchTerm searchTerm : query.getSearchTerms()) {
  7. final String searchValue = searchTerm.getValue();
  8. if (searchValue == null) {
  9. throw new IllegalArgumentException("Empty search value not allowed (for term '" + searchTerm.getSearchableField().getFriendlyName() + "')");
  10. }
  11. if (searchValue.contains("*") || searchValue.contains("?")) {
  12. luceneQuery.add(new BooleanClause(new WildcardQuery(new Term(searchTerm.getSearchableField().getSearchableFieldName(), searchTerm.getValue().toLowerCase())), Occur.MUST));
  13. } else {
  14. luceneQuery.add(new BooleanClause(new TermQuery(new Term(searchTerm.getSearchableField().getSearchableFieldName(), searchTerm.getValue().toLowerCase())), Occur.MUST));
  15. }
  16. }
  17. final Long minBytes = query.getMinFileSize() == null ? null : DataUnit.parseDataSize(query.getMinFileSize(), DataUnit.B).longValue();
  18. final Long maxBytes = query.getMaxFileSize() == null ? null : DataUnit.parseDataSize(query.getMaxFileSize(), DataUnit.B).longValue();
  19. if (minBytes != null || maxBytes != null) {
  20. luceneQuery.add(NumericRangeQuery.newLongRange(SearchableFields.FileSize.getSearchableFieldName(), minBytes, maxBytes, true, true), Occur.MUST);
  21. }
  22. final Long minDateTime = query.getStartDate() == null ? null : query.getStartDate().getTime();
  23. final Long maxDateTime = query.getEndDate() == null ? null : query.getEndDate().getTime();
  24. if (maxDateTime != null || minDateTime != null) {
  25. luceneQuery.add(NumericRangeQuery.newLongRange(SearchableFields.EventTime.getSearchableFieldName(), minDateTime, maxDateTime, true, true), Occur.MUST);
  26. }
  27. return luceneQuery;
  28. }

代码示例来源:origin: apache/nifi

  1. query.getEndDate() == null ? null : query.getEndDate().getTime());

代码示例来源:origin: apache/nifi

  1. requestDto.setEndDate(query.getEndDate());
  2. requestDto.setMinimumFileSize(query.getMinFileSize());
  3. requestDto.setMaximumFileSize(query.getMaxFileSize());

相关文章