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

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

本文整理了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

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

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

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

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

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

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

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

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

  1. @Override
  2. public Query<?> getSubQueryWithGroupBy() {
  3. if (subQueryTypes == null) {
  4. return null;
  5. }
  6. Query<?> subQuery = Query.fromAll();
  7. String keySuffix = "/" + subQueryKey;
  8. for (ObjectType type : subQueryTypes) {
  9. subQuery.sortAscending(type.getInternalName() + keySuffix);
  10. }
  11. return subQuery;
  12. }

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

  1. private <T extends SearchAdvancedPredicate> T findSearchAdvancedPredicate(Class<T> predicateClass, String value) {
  2. for (T p : Query
  3. .from(predicateClass)
  4. .sortAscending("dari.singleton.key")
  5. .selectAll()) {
  6. if (p.getParameterValue().equals(value)) {
  7. return p;
  8. }
  9. }
  10. return null;
  11. }

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

  1. .sortAscending("triggerDate")
  2. .master()
  3. .noCache()

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

  1. /**
  2. * Finds the template that should be used to render the given
  3. * {@code object} in the given {@code site}.
  4. */
  5. public static Template findRenderable(Object object, Site site) {
  6. if (object == null) {
  7. return null;
  8. }
  9. State objectState = State.getInstance(object);
  10. Template template = objectState.as(ObjectModification.class).getDefault();
  11. if (template != null && Site.Static.isObjectAccessible(site, template)) {
  12. return template;
  13. }
  14. ObjectType objectType = objectState.getType();
  15. List<Template> usable = new ArrayList<Template>();
  16. for (Template t : Query.from(Template.class).sortAscending("name").selectAll()) {
  17. if (Site.Static.isObjectAccessible(site, t) &&
  18. t.getContentTypes().contains(objectType)) {
  19. usable.add(t);
  20. }
  21. }
  22. return usable.size() == 1 ? usable.get(0) : null;
  23. }

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

  1. /**
  2. * Finds a list of all templates that are usable with the given
  3. * {@code object}.
  4. *
  5. * @return Never {@code null}. Mutable.
  6. */
  7. public static List<Template> findUsable(Object object) {
  8. List<Template> templates = new ArrayList<Template>();
  9. if (object != null) {
  10. State state = State.getInstance(object);
  11. Site owner = state.as(Site.ObjectModification.class).getOwner();
  12. ObjectType type = state.getType();
  13. for (Template template : Query.from(Template.class).sortAscending("name").selectAll()) {
  14. if (template.getContentTypes().contains(type) &&
  15. (owner == null ||
  16. Site.Static.isObjectAccessible(owner, template))) {
  17. templates.add(template);
  18. }
  19. }
  20. }
  21. return templates;
  22. }

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

  1. @Override
  2. protected Query<?> createQuery(Directory directory) {
  3. return (itemType != null ? Query.fromType(itemType) : Query.fromAll())
  4. .and(page.siteItemsSearchPredicate())
  5. .and(directory.itemsPredicate(page.getSite()))
  6. .sortAscending(Directory.PATHS_FIELD);
  7. }
  8. });

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

  1. public Query<?> toQuery() {
  2. State state = getState();
  3. Query<?> query = Query.fromType(getQueryType());
  4. Predicate predicate = query.getPredicate();
  5. for (ObjectField field : getIndexedFields()) {
  6. String name = field.getInternalName();
  7. Object value = state.get(FIELD_PREFIX + name);
  8. if (!ObjectUtils.isBlank(value)) {
  9. String type = field.getInternalItemType();
  10. String operator = (String) state.get(OPERATOR_PREFIX + name);
  11. if (operator == null) {
  12. operator = ObjectField.REFERENTIAL_TEXT_TYPE.equals(type) || ObjectField.TEXT_TYPE.equals(type) ? "matchesAll" : "equalsAny";
  13. }
  14. predicate = CompoundPredicate.combine(
  15. PredicateParser.AND_OPERATOR,
  16. predicate,
  17. PredicateParser.Static.parse(name + " " + operator + " ?", value));
  18. }
  19. }
  20. query.setPredicate(predicate);
  21. ObjectField sortField = getSortField();
  22. if (ObjectField.DATE_TYPE.equals(sortField.getInternalItemType())) {
  23. query.sortDescending(sortField.getInternalName());
  24. } else {
  25. query.sortAscending(sortField.getInternalName());
  26. }
  27. return query;
  28. }

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

  1. query.sortDescending(sortField);
  2. } else {
  3. query.sortAscending(sortField);

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

  1. query.sortAscending(junctionPositionField);

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

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

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

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

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

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

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

  1. .from(Schedule.class)
  2. .where("name != missing")
  3. .sortAscending("name")
  4. .selectAll()) {
  5. page.writeStart("li");

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

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

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

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

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

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

相关文章