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

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

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

Query.getOrderByClause介绍

暂无

代码示例

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

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

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

public List<SearchSort> getSearchSorts(SearchRequest searchRequest)
{
  if (searchRequest != null && searchRequest.getQuery().getOrderByClause() != null)
  {
    return searchRequest.getQuery().getOrderByClause().getSearchSorts();
  }
  return Collections.emptyList();
}

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

public List<SearchSort> getSearchSorts(final Query query)
{
  List<SearchSort> sorts;
  // NOTE: when the whole query is null we fall back to the default sorts.
  if (query == null)
  {
    sorts = Collections.emptyList();
  }
  else
  {
    // NOTE: when the order by clause is null we use this condition to force us to use not sorts for our query at all.
    if (query.getOrderByClause() == null)
    {
      return null;
    }
    sorts = query.getOrderByClause().getSearchSorts();
  }
  // This is a special case where we want to put in the default JIRA sorts
  if (sorts.isEmpty())
  {
    //If we have a free text query, then we don't want any sorts so that Lucene's rank will work for us.
    if (query == null || !FreeTextVisitor.containsFreeTextCondition(query.getWhereClause()))
    {
      //By default we sort by the "Issue Key" when there is no text searcher to rank the results.
      sorts = Collections.singletonList(DEFAULT_KEY_SORT);
    }
  }
  return sorts;
}

代码示例来源: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-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

private Query process(Query query, ClauseVisitor<Clause> visitor)
{
  notNull("query", query);
  final Clause clause = query.getWhereClause();
  if (clause == null)
  {
    return query;
  }
  final Clause sanitisedClause = clause.accept(visitor);
  if (!clause.equals(sanitisedClause))
  {
    return new QueryImpl(sanitisedClause, query.getOrderByClause(), null);
  }
  else
  {
    return query;
  }
}

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

/**
 * @deprecated Since 6.3.3, due to performance issues when calculating the query contexts on
 * the call to {@link #checkSimpleWhereClauses(com.atlassian.crowd.embedded.api.User, com.atlassian.query.Query, com.atlassian.query.Query)}
 */
@Deprecated
boolean simpleSearchRequestsSameOrQueriesEquivalent(final ApplicationUser user, final SearchRequest oldSearchRequest, final SearchRequest newSearchRequest)
{
  if (!nonQueryAttributesEquals(newSearchRequest, oldSearchRequest))
  {
    return false;
  }
  else
  {
    Query oldQuery = oldSearchRequest.getQuery();
    Query query = newSearchRequest.getQuery();
    return checkOrderByClauses(oldQuery.getOrderByClause(), query.getOrderByClause()) && checkSimpleWhereClauses(user, oldSearchRequest.getQuery(), newSearchRequest.getQuery());
  }
}

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

builder.append(jqlStringVisitor.toJqlString(query.getWhereClause()));
if (query.getOrderByClause() != null && !query.getOrderByClause().getSearchSorts().isEmpty())
  for (Iterator<SearchSort> sortIterator = query.getOrderByClause().getSearchSorts().iterator(); sortIterator.hasNext();)

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

/**
 * Combines sorts from the old search request, action parameters and additional JQL query (in the reverse order).
 * If sorts are not specified or empty, they are ignored.
 *
 * @param oldSearchRequest the old search request
 * @param searchUser the user
 * @param actionParameters the action parameters
 * @return the list of combined search sorts; should not be null.
 */
List<SearchSort> combineSorts(final SearchRequest oldSearchRequest, final ApplicationUser searchUser, final ActionParams actionParameters)
{
  List<SearchSort> oldSearchRequestSorts = null;
  if (oldSearchRequest != null && oldSearchRequest.getQuery().getOrderByClause() != null && !oldSearchRequest.getQuery().getOrderByClause().getSearchSorts().isEmpty())
  {
    oldSearchRequestSorts = oldSearchRequest.getQuery().getOrderByClause().getSearchSorts();
  }
  // Get the search sorts from the parameters
  final OrderBy paramsOrderBy = searchSortUtil.getOrderByClause(actionParameters.getKeysAndValues());
  // the order of combining the sorts is:
  // oldSearchRequestSorts are last;
  // then Sorts from params;
  List<SearchSort> combinedSorts = paramsOrderBy.getSearchSorts();
  if (oldSearchRequestSorts != null)
  {
    combinedSorts = searchSortUtil.mergeSearchSorts(searchUser, combinedSorts, oldSearchRequestSorts, Integer.MAX_VALUE);
  }
  return combinedSorts;
}

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

public IssueTableLayoutBean getTableLayout(final ApplicationUser user) throws Exception
{
  final SearchRequest searchRequest = getSearchRequest();
  Collection<SearchSort> searchSorts = null;
  if (searchRequest != null)
  {
    final Query query = searchRequest.getQuery();
    if (query.getOrderByClause() != null)
    {
      searchSorts = query.getOrderByClause().getSearchSorts();
    }
  }
  final IssueTableLayoutBean bean = new IssueTableLayoutBean(getColumns(user), searchSorts);
  bean.setSortingEnabled(false);
  bean.addCellDisplayParam(FieldRenderingContext.EMAIL_VIEW, Boolean.TRUE);
  return bean;
}

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

query.query = new QueryImpl(query.query.getWhereClause(), query.query.getOrderByClause(), null);

代码示例来源: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

final OrderBy orderBy = query.getOrderByClause();
if (orderBy != null)

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

private IssueTableLayoutBean createLayout(final LinkedLabelledQuery linkedLabelledQuery, final List<ColumnLayoutItem> columns, final boolean enableSorting, final boolean displayHeader, final boolean showActions)
{
  final OrderBy orderBy = linkedLabelledQuery.query.getOrderByClause();
  final IssueTableLayoutBean layout = new IssueTableLayoutBean(columns, orderBy.getSearchSorts());
  layout.setSortingEnabled(enableSorting);
  layout.setDisplayHeader(displayHeader);
  layout.setShowExteriorTable(false);
  layout.setShowActionColumn(showActions);
  layout.setTableCssClass("grid issuetable-db maxWidth");
  layout.setDisplayHeaderPager(false);
  return layout;
}

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

/**
 * Check that two {@link SearchRequest}s are the same (not taking into account JQL), or have equivalent JQL clauses.
 *
 * @param oldSearchRequest the old search request
 * @param searchRequest the new search request
 * @return true if they are the same or equivalent; false otherwise.
 */
boolean searchRequestsSameOrQueriesEquivalent(final SearchRequest oldSearchRequest, final SearchRequest searchRequest)
{
  if (!nonQueryAttributesEquals(searchRequest, oldSearchRequest))
  {
    return false;
  }
  else if (oldSearchRequest.getQuery().getQueryString() != null && searchRequest.getQuery().getQueryString() != null)
  {
    return oldSearchRequest.getQuery().getQueryString().equals(searchRequest.getQuery().getQueryString());
  }
  else
  {
    return  checkOrderByClauses(oldSearchRequest.getQuery().getOrderByClause(), searchRequest.getQuery().getOrderByClause()) &&
        checkWhereClauses(oldSearchRequest.getQuery().getWhereClause(), searchRequest.getQuery().getWhereClause());
  }
}

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

private void updateSearchRequestIfContainsCustomFieldIds(final GenericValue searchRequestGv, final Map<String, String> substitutions)
    throws GenericEntityException
{
  // Read in the SearchRequest XML
  final String jql = searchRequestGv.getString("request");
  //JRA-23588 - Oracle can read in an empty string as null
  final String sanitisedJql = (jql == null) ? "" : jql;
  try
  {
    final Query query = jqlQueryParser.parseQuery(sanitisedJql);
    if (query.getWhereClause() != null)
    {
      ClauseVisitor<Clause> renamer = new ClauseRenamingCloningVisitor(substitutions);
      final Clause renamedClause = query.getWhereClause().accept(renamer);
      if (!renamedClause.equals(query.getWhereClause()))
      {
        final QueryImpl newQuery = new QueryImpl(renamedClause, query.getOrderByClause(), null);
        searchRequestGv.setString("request", jqlStringSupport.generateJqlString(newQuery));
        searchRequestGv.store();
      }
    }
  }
  catch (JqlParseException e)
  {
    log.error("Error parsing query '" + jql + "'.  The Filter '" + searchRequestGv.getString("name") + "' will not be converted to use the new Labels system field!");
  }
}

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

if (searchRequest.getQuery().getOrderByClause() != null)
      searchRequest.getQuery().getOrderByClause().getSearchSorts(),
      Integer.MAX_VALUE));

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

if (searchRequestInfo.query != null && searchRequestInfo.query.getOrderByClause() != null
    && !searchRequestInfo.query.getOrderByClause().getSearchSorts().isEmpty())

相关文章