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

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

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

Query.or介绍

[英]Combines the given predicate with the current one using OR logic. If the current predicate is null, the given predicate replaces it.
[中]使用OR逻辑将给定谓词与当前谓词组合。如果当前谓词为null,则给定的谓词将替换它。

代码示例

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

  1. /**
  2. * Parses the given {@linkplain PredicateParser.Static#parse predicateString}
  3. * with the given {@code parameters} and {@linkplain #or(Predicate)
  4. * adds it} to the current one.
  5. */
  6. public Query<E> or(String predicateString, Object... parameters) {
  7. return or(PredicateParser.Static.parse(predicateString, parameters));
  8. }

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

  1. @Override
  2. public Query<?> getSubQueryWithComparison(ComparisonPredicate comparison) {
  3. if (subQueryTypes == null) {
  4. return comparison.findValueQuery();
  5. }
  6. Query<?> subQuery = Query.fromAll();
  7. String keySuffix = "/" + subQueryKey;
  8. for (ObjectType type : subQueryTypes) {
  9. subQuery.or(new ComparisonPredicate(
  10. comparison.getOperator(),
  11. comparison.isIgnoreCase(),
  12. type.getInternalName() + keySuffix,
  13. comparison.getValues()));
  14. }
  15. return subQuery;
  16. }

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

  1. /**
  2. * Returns SearchResultSelections that are accessible to the specified {@link ToolUser}, optionally excluding selections
  3. * that were created by the user.
  4. * @param user the {@link ToolUser} for which SearchResultSelections should be returned.
  5. * @param excludeOwn excludes selections created by the specified {@link ToolUser} if true.
  6. * @return accessible {@link SearchResultSelection}s for the specified {@link ToolUser}.
  7. */
  8. public static List<SearchResultSelection> findAccessibleSelections(ToolUser user, boolean excludeOwn) {
  9. if (user == null) {
  10. return null;
  11. }
  12. Query<SearchResultSelection> query = Query.from(SearchResultSelection.class);
  13. if (user.getRole() == null) {
  14. query.where("entities != missing");
  15. } else {
  16. query.where("entities = ?", user.getRole());
  17. }
  18. if (excludeOwn) {
  19. query.and("entities != ?", user);
  20. } else {
  21. query.or("entities = ?", user);
  22. }
  23. return query.selectAll();
  24. }

相关文章