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

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

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

Query.getStartDate介绍

暂无

代码示例

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

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");
  }
}

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

@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();
  }
}

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

@Override
public QuerySubmission submitQuery(final Query query, final NiFiUser user) {
  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");
  }
  final String userId = user == null ? null : user.getIdentity();
  if (query.getSearchTerms().isEmpty() && query.getStartDate() == null && query.getEndDate() == null) {
    final AsyncQuerySubmission result = new AsyncQuerySubmission(query, 1, userId);
    queryExecService.submit(new QueryRunnable(ringBuffer, createFilter(query, user), query.getMaxResults(), result));
    querySubmissionMap.put(query.getIdentifier(), result);
    return result;
  }
  final AsyncQuerySubmission result = new AsyncQuerySubmission(query, 1, userId);
  querySubmissionMap.put(query.getIdentifier(), result);
  queryExecService.submit(new QueryRunnable(ringBuffer, createFilter(query, user), query.getMaxResults(), result));
  return result;
}

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

@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);
}

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

if (query.getStartDate() != null && query.getStartDate().getTime() > event.getEventTime()) {
  return false;

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

if (provenanceQuery.getStartDate() == null || provenanceQuery.getStartDate().getTime() < firstEventTimestamp) {
  provenanceQuery.setStartDate(new Date(firstEventTimestamp));

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

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");
if (query.getSearchTerms().isEmpty() && query.getStartDate() == null && query.getEndDate() == null) {
  final AsyncQuerySubmission result = new AsyncQuerySubmission(query, 1, userId);
    query.getStartDate() == null ? null : query.getStartDate().getTime(),
    query.getEndDate() == null ? null : query.getEndDate().getTime());
final AsyncQuerySubmission result = new AsyncQuerySubmission(query, indexDirectories.size(), userId);

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

public static org.apache.lucene.search.Query convertQuery(final org.apache.nifi.provenance.search.Query query) {
  if (query.getStartDate() == null && query.getEndDate() == null && query.getSearchTerms().isEmpty()) {
    return new MatchAllDocsQuery();
  }
  final BooleanQuery luceneQuery = new BooleanQuery();
  for (final SearchTerm searchTerm : query.getSearchTerms()) {
    final String searchValue = searchTerm.getValue();
    if (searchValue == null) {
      throw new IllegalArgumentException("Empty search value not allowed (for term '" + searchTerm.getSearchableField().getFriendlyName() + "')");
    }
    if (searchValue.contains("*") || searchValue.contains("?")) {
      luceneQuery.add(new BooleanClause(new WildcardQuery(new Term(searchTerm.getSearchableField().getSearchableFieldName(), searchTerm.getValue().toLowerCase())), Occur.MUST));
    } else {
      luceneQuery.add(new BooleanClause(new TermQuery(new Term(searchTerm.getSearchableField().getSearchableFieldName(), searchTerm.getValue().toLowerCase())), Occur.MUST));
    }
  }
  final Long minBytes = query.getMinFileSize() == null ? null : DataUnit.parseDataSize(query.getMinFileSize(), DataUnit.B).longValue();
  final Long maxBytes = query.getMaxFileSize() == null ? null : DataUnit.parseDataSize(query.getMaxFileSize(), DataUnit.B).longValue();
  if (minBytes != null || maxBytes != null) {
    luceneQuery.add(NumericRangeQuery.newLongRange(SearchableFields.FileSize.getSearchableFieldName(), minBytes, maxBytes, true, true), Occur.MUST);
  }
  final Long minDateTime = query.getStartDate() == null ? null : query.getStartDate().getTime();
  final Long maxDateTime = query.getEndDate() == null ? null : query.getEndDate().getTime();
  if (maxDateTime != null || minDateTime != null) {
    luceneQuery.add(NumericRangeQuery.newLongRange(SearchableFields.EventTime.getSearchableFieldName(), minDateTime, maxDateTime, true, true), Occur.MUST);
  }
  return luceneQuery;
}

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

query.getStartDate() == null ? null : query.getStartDate().getTime(),
query.getEndDate() == null ? null : query.getEndDate().getTime());

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

requestDto.setStartDate(query.getStartDate());
requestDto.setEndDate(query.getEndDate());
requestDto.setMinimumFileSize(query.getMinFileSize());

相关文章