com.atlassian.query.Query.getWhereClause()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(130)

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

Query.getWhereClause介绍

暂无

代码示例

代码示例来源:origin: com.atlassian.jira/jira-api

/**
 * Build a new {@link com.atlassian.jira.jql.builder.JqlClauseBuilder} and initialise it with the clause from the
 * passed query. The returned builder will have no associated {@link com.atlassian.jira.jql.builder.JqlQueryBuilder}.
 *
 * @param query the query whose where clause will be copied into the new builder. Can be null.
 * @return the new clause builder.
 */
@Nonnull
public static JqlClauseBuilder newClauseBuilder(Query query)
{
  return createClauseBuilder(null, query == null ? null : query.getWhereClause());
}

代码示例来源:origin: com.atlassian.jira/jira-core

public boolean doRelevantClausesFitFilterForm(final ApplicationUser user, final Query query, final SearchContext searchContext)
{
  if (query != null && query.getWhereClause() != null)
  {
    WorkRatioSearcherInputHelper helper = createWorkRatioSearcherInputHelper();
    if (helper.convertClause(query.getWhereClause(), user) == null)
    {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: com.atlassian.jira/jira-api

public boolean doRelevantClausesFitFilterForm(final ApplicationUser user, final Query query, final SearchContext searchContext)
{
  return query.getWhereClause() == null || inputHelper.getValuesFromQuery(query) != null;
}

代码示例来源:origin: com.atlassian.jira/jira-api

private List<TerminalClause> getMatchingClauses(final Set<String> jqlClauseNames, final Query query)
  {
    final NamedTerminalClauseCollectingVisitor clauseVisitor = new NamedTerminalClauseCollectingVisitor(jqlClauseNames);
    if(query != null && query.getWhereClause() != null)
    {
      query.getWhereClause().accept(clauseVisitor);
      return clauseVisitor.getNamedClauses();
    }
    return Collections.emptyList();
  }
}

代码示例来源:origin: com.atlassian.jira/jira-core

protected List<TerminalClause> getMatchingClauses(final Set<String> jqlClauseNames, final Query query)
{
  final NamedTerminalClauseCollectingVisitor clauseVisitor = new NamedTerminalClauseCollectingVisitor(jqlClauseNames);
  if(query.getWhereClause() != null)
  {
    query.getWhereClause().accept(clauseVisitor);
    return clauseVisitor.getNamedClauses();
  }
  return Collections.emptyList();
}

代码示例来源:origin: com.atlassian.jira/jira-gadgets-plugin

private int getNumberClauses(@Nonnull final Query query)
{
  final TerminalClauseCollectingVisitor clauseVisitor = new TerminalClauseCollectingVisitor();
  if (query.getWhereClause() != null)
  {
    query.getWhereClause().accept(clauseVisitor);
  }
  return clauseVisitor.getClauses().size();
}

代码示例来源:origin: com.atlassian.jira/jira-core

private List<TerminalClause> getMatchingClauses(final Set<String> jqlClauseNames, final Query query)
{
  NamedTerminalClauseCollectingVisitor clauseVisitor = new NamedTerminalClauseCollectingVisitor(jqlClauseNames);
  if(query != null && query.getWhereClause() != null)
  {
    query.getWhereClause().accept(clauseVisitor);
    return clauseVisitor.getNamedClauses();
  }
  return Collections.emptyList();
}

代码示例来源:origin: com.atlassian.jira/jira-core

public boolean doRelevantClausesFitFilterForm(final ApplicationUser user, final Query query, final SearchContext searchContext)
{
  if (query != null && query.getWhereClause() != null)
  {
    final Clause whereClause = query.getWhereClause();
    // check that it conforms to simple navigator structure, and that the right number of clauses appear
    // with the correct operators
    DateSearcherInputHelper inputHelper = createDateSearcherInputHelper();
    return inputHelper.convertClause(whereClause, user, allowTimeComponent).fitsFilterForm();
  }
  return true;
}

代码示例来源:origin: com.atlassian.jira/jira-api

@Override
public boolean doRelevantClausesFitFilterForm(ApplicationUser user, Query query, SearchContext searchContext)
{
  if (query != null && query.getWhereClause() != null)
  {
    final Clause whereClause = query.getWhereClause();
    // check that it conforms to simple navigator structure, and that the right number of clauses appear
    // with the correct operators
    DateSearcherInputHelper inputHelper = createDateSearcherInputHelper();
    return inputHelper.convertClause(whereClause, user, false).fitsFilterForm();
  }
  return true;
}

代码示例来源:origin: com.atlassian.jira/jira-core

Query getQueryFromSavedFilter(final QueryCreationContext queryCreationContext, final SearchRequest savedFilter)
{
  if (savedFilter.getQuery().getWhereClause() == null)
  {
    return new MatchAllDocsQuery();
  }
  return queryVisitor.createQuery(savedFilter.getQuery().getWhereClause(), queryCreationContext);
}
///CLOVER:ON

代码示例来源:origin: com.atlassian.jira/jira-api

boolean isExistsInQuery(Query query)
  {
    final NamedTerminalClauseCollectingVisitor clauseVisitor = new NamedTerminalClauseCollectingVisitor(clauseNames.getJqlFieldNames());
    if (query != null && query.getWhereClause() != null)
    {
      query.getWhereClause().accept(clauseVisitor);
    }
    return clauseVisitor.containsNamedClause();
  }
}

代码示例来源:origin: com.atlassian.jira/jira-api

protected boolean isRelevantForQuery(final ClauseNames clauseNames, final Query query)
{
  if ((query != null) && (query.getWhereClause() != null))
  {
    final NamedTerminalClauseCollectingVisitor clauseVisitor = new NamedTerminalClauseCollectingVisitor(clauseNames.getJqlFieldNames());
    query.getWhereClause().accept(clauseVisitor);
    return clauseVisitor.containsNamedClause();
  }
  else
  {
    return false;
  }
}

代码示例来源:origin: com.atlassian.jira/jira-core

public void populateFromQuery(final ApplicationUser user, final FieldValuesHolder fieldValuesHolder, final Query query, final SearchContext searchContext)
{
  notNull("fieldValuesHolder", fieldValuesHolder);
  notNull("query", query);
  if (query.getWhereClause() != null)
  {
    WorkRatioSearcherInputHelper helper = createWorkRatioSearcherInputHelper();
    final Map<String, String> result = helper.convertClause(query.getWhereClause(), user);
    if (result != null)
    {
      fieldValuesHolder.putAll(result);
    }
  }
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
public boolean doRelevantClausesFitFilterForm(final ApplicationUser user, final Query query, final SearchContext searchContext)
{
  if (query != null && query.getWhereClause() != null)
  {
    final Clause whereClause = query.getWhereClause();
    TextQueryValidatingVisitor visitor = new TextQueryValidatingVisitor(clauseNames.getPrimaryName());
    whereClause.accept(visitor);
    if (visitor.isValid()) {
      final String textQuery = visitor.getTextTerminalValue(operandResolver, user);
      return textQuery != null;
    }
  }
  return false;
}

代码示例来源:origin: com.atlassian.jira/jira-api

private JqlQueryBuilder(Query existingQuery)
{
  Clause exisitingClause = null;
  OrderBy exisitngOrderBy = null;
  if (existingQuery != null)
  {
    exisitingClause = existingQuery.getWhereClause();
    exisitngOrderBy = existingQuery.getOrderByClause();
  }
  this.jqlClauseBuilder = createClauseBuilder(this, exisitingClause);
  this.jqlOrderByBuilder = createOrderByBuilder(this, exisitngOrderBy);
}

代码示例来源:origin: com.atlassian.jira/jira-core

private boolean checkValidValues(ApplicationUser searcher, Query query)
{
  SimpleNavigatorCollectorVisitor collector = new SimpleNavigatorCollectorVisitor(clauseNames.getJqlFieldNames());
  if (query != null && query.getWhereClause() != null)
  {
    query.getWhereClause().accept(collector);
    if (collector.getClauses().size() == 1)
    {
      TerminalClause terminalClause = collector.getClauses().get(0);
      Operand operand = terminalClause.getOperand();
      return checkValidValues(searcher, operand, terminalClause);
    }
  }
  return true;
}

代码示例来源:origin: com.atlassian.jira/jira-core

public void populateFromQuery(final ApplicationUser user, final FieldValuesHolder fieldValuesHolder, final Query query, final SearchContext searchContext)
{
  notNull("fieldValuesHolder", fieldValuesHolder);
  notNull("query", query);
  if (query.getWhereClause() != null)
  {
    DateSearcherInputHelper helper = createDateSearcherInputHelper();
    final DateSearcherInputHelper.ConvertClauseResult clauseResult = helper.convertClause(query.getWhereClause(), user, allowTimeComponent);
    final Map<String, String> result = clauseResult.getFields();
    if (result != null)
    {
      fieldValuesHolder.putAll(result);
    }
  }
}

代码示例来源:origin: com.atlassian.jira/jira-gadgets-plugin

public Map<String, String> generateColumnSortJql(SearchRequest sr, LinkedLabelledQuery query, List<ColumnLayoutItem> columns)
{
  Map<String, String> columnSortJql = new HashMap<String, String>();
  for (ColumnLayoutItem column : columns)
  {
    final String id = column.getId();
    OrderBy ob = buildOrderBy(sr.getQuery().getOrderByClause(), id);
    Query queryWithOrder = new QueryImpl(query.query.getWhereClause(), ob, null);
    columnSortJql.put(id, jqlStringSupport.generateJqlString(queryWithOrder));
  }
  return columnSortJql;
}

代码示例来源:origin: com.atlassian.jira/jira-core

public Query optimizeQuery(final Query query)
{
  final Clause whereClause = query.getWhereClause();
  if (whereClause == null)
  {
    return query;
  }
  return new QueryImpl(whereClause.accept(new ClauseOptimizerVisitor()), query.getOrderByClause(), null);
}

代码示例来源:origin: com.atlassian.jira/jira-core

protected SearchRequest getRequest(IssuePickerSearchService.IssuePickerParameters issuePickerParams)
{
  if (issuePickerParams.getCurrentJQL() != null)
  {
    final ApplicationUser user = authenticationContext.getUser();
    final SearchService.ParseResult parseResult = searchService.parseQuery(user, issuePickerParams.getCurrentJQL());
    if (parseResult.isValid())
    {
      // make sure we remove the sort order
      return new SearchRequest(new QueryImpl(parseResult.getQuery().getWhereClause(), null, null));
    }
  }
  return null;
}

相关文章