com.psddev.dari.db.Query.sortAscending()方法的使用及代码示例

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

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

Query.sortAscending介绍

[英]Adds a sorter that prioritizes the smaller values associated with the given key.
[中]添加一个排序器,对与给定键关联的较小值进行优先级排序。

代码示例

代码示例来源:origin: perfectsense/dari

private ByIdIterator(Query<T> query, int fetchSize) {
  this.query = query.clone().sortAscending("_type").sortAscending("_id");
  this.fetchSize = fetchSize > 0 ? fetchSize : 200;
}

代码示例来源:origin: perfectsense/dari

public ByIdIterator(Query<T> query, int fetchSize) {
  this.query = query.clone().sortAscending("_id");
  this.fetchSize = fetchSize > 0 ? fetchSize : 200;
}

代码示例来源:origin: perfectsense/dari

public ByIdIterator(Query<T> query, int fetchSize) {
  if (!query.getSorters().isEmpty()) {
    throw new IllegalArgumentException("Can't iterate over a query that has sorters!");
  }
  this.query = query.clone().timeout(0.0).sortAscending("_type").sortAscending("_id");
  this.fetchSize = fetchSize > 0 ? fetchSize : 200;
}

代码示例来源:origin: perfectsense/brightspot-cms

/**
 * Returns a cached list of all templates in the given {@code site}.
 */
public static List<Template> findAll(Site site) {
  List<Template> templates = new ArrayList<Template>();
  for (Template template : Query.from(Template.class).sortAscending("name").selectAll()) {
    if (Site.Static.isObjectAccessible(site, template)) {
      templates.add(template);
    }
  }
  return templates;
}

代码示例来源:origin: perfectsense/dari

@Override
public Query<?> getSubQueryWithGroupBy() {
  if (subQueryTypes == null) {
    return null;
  }
  Query<?> subQuery = Query.fromAll();
  String keySuffix = "/" + subQueryKey;
  for (ObjectType type : subQueryTypes) {
    subQuery.sortAscending(type.getInternalName() + keySuffix);
  }
  return subQuery;
}

代码示例来源:origin: perfectsense/brightspot-cms

private <T extends SearchAdvancedPredicate> T findSearchAdvancedPredicate(Class<T> predicateClass, String value) {
  for (T p : Query
      .from(predicateClass)
      .sortAscending("dari.singleton.key")
      .selectAll()) {
    if (p.getParameterValue().equals(value)) {
      return p;
    }
  }
  return null;
}

代码示例来源:origin: perfectsense/brightspot-cms

.sortAscending("triggerDate")
.master()
.noCache()

代码示例来源:origin: perfectsense/brightspot-cms

/**
 * Finds the template that should be used to render the given
 * {@code object} in the given {@code site}.
 */
public static Template findRenderable(Object object, Site site) {
  if (object == null) {
    return null;
  }
  State objectState = State.getInstance(object);
  Template template = objectState.as(ObjectModification.class).getDefault();
  if (template != null && Site.Static.isObjectAccessible(site, template)) {
    return template;
  }
  ObjectType objectType = objectState.getType();
  List<Template> usable = new ArrayList<Template>();
  for (Template t : Query.from(Template.class).sortAscending("name").selectAll()) {
    if (Site.Static.isObjectAccessible(site, t) &&
        t.getContentTypes().contains(objectType)) {
      usable.add(t);
    }
  }
  return usable.size() == 1 ? usable.get(0) : null;
}

代码示例来源:origin: perfectsense/brightspot-cms

/**
 * Finds a list of all templates that are usable with the given
 * {@code object}.
 *
 * @return Never {@code null}. Mutable.
 */
public static List<Template> findUsable(Object object) {
  List<Template> templates = new ArrayList<Template>();
  if (object != null) {
    State state = State.getInstance(object);
    Site owner = state.as(Site.ObjectModification.class).getOwner();
    ObjectType type = state.getType();
    for (Template template : Query.from(Template.class).sortAscending("name").selectAll()) {
      if (template.getContentTypes().contains(type) &&
          (owner == null ||
          Site.Static.isObjectAccessible(owner, template))) {
        templates.add(template);
      }
    }
  }
  return templates;
}

代码示例来源:origin: perfectsense/brightspot-cms

@Override
  protected Query<?> createQuery(Directory directory) {
    return (itemType != null ? Query.fromType(itemType) : Query.fromAll())
        .and(page.siteItemsSearchPredicate())
        .and(directory.itemsPredicate(page.getSite()))
        .sortAscending(Directory.PATHS_FIELD);
  }
});

代码示例来源:origin: perfectsense/brightspot-cms

public Query<?> toQuery() {
  State state = getState();
  Query<?> query = Query.fromType(getQueryType());
  Predicate predicate = query.getPredicate();
  for (ObjectField field : getIndexedFields()) {
    String name = field.getInternalName();
    Object value = state.get(FIELD_PREFIX + name);
    if (!ObjectUtils.isBlank(value)) {
      String type = field.getInternalItemType();
      String operator = (String) state.get(OPERATOR_PREFIX + name);
      if (operator == null) {
        operator = ObjectField.REFERENTIAL_TEXT_TYPE.equals(type) || ObjectField.TEXT_TYPE.equals(type) ? "matchesAll" : "equalsAny";
      }
      predicate = CompoundPredicate.combine(
          PredicateParser.AND_OPERATOR,
          predicate,
          PredicateParser.Static.parse(name + " " + operator + " ?", value));
    }
  }
  query.setPredicate(predicate);
  ObjectField sortField = getSortField();
  if (ObjectField.DATE_TYPE.equals(sortField.getInternalItemType())) {
    query.sortDescending(sortField.getInternalName());
  } else {
    query.sortAscending(sortField.getInternalName());
  }
  return query;
}

代码示例来源:origin: perfectsense/dari

query.sortDescending(sortField);
} else {
  query.sortAscending(sortField);

代码示例来源:origin: perfectsense/dari

query.sortAscending(junctionPositionField);

代码示例来源:origin: perfectsense/brightspot-cms

.from(Schedule.class)
.where("triggerDate >= ? and triggerDate < ?", begin, end)
.sortAscending("triggerDate")
.iterable(0)) {

代码示例来源:origin: perfectsense/brightspot-cms

toolEntityQuery = Query.from(ToolRole.class).sortAscending("name");
toolEntityQuery = Query.from(ToolUser.class).sortAscending("name");

代码示例来源:origin: perfectsense/brightspot-cms

.from(Schedule.class)
.where("triggerDate >= ? and triggerDate < ?", begin, end)
.sortAscending("triggerDate")
.iterable(0)) {

代码示例来源:origin: perfectsense/brightspot-cms

.from(Schedule.class)
  .where("name != missing")
  .sortAscending("name")
  .selectAll()) {
page.writeStart("li");

代码示例来源:origin: perfectsense/brightspot-cms

for (SearchAdvancedPredicate pt : Query
    .from(SearchAdvancedPredicate.class)
    .sortAscending("dari.singleton.key")
    .selectAll()) {
  page.writeStart("option",

代码示例来源:origin: perfectsense/brightspot-cms

toolEntityQuery = Query.from(ToolRole.class).sortAscending("name");
toolEntityQuery = Query.from(ToolUser.class).sortAscending("name");

代码示例来源:origin: perfectsense/brightspot-cms

.sortAscending("name")
  .selectAll()) {
page.writeStart("li", "class", workflow.equals(selected) ? "selected" : null);

相关文章