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

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

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

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

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

@Override
public Query<?> getSubQueryWithComparison(ComparisonPredicate comparison) {
  if (subQueryTypes == null) {
    return comparison.findValueQuery();
  }
  Query<?> subQuery = Query.fromAll();
  String keySuffix = "/" + subQueryKey;
  for (ObjectType type : subQueryTypes) {
    subQuery.or(new ComparisonPredicate(
        comparison.getOperator(),
        comparison.isIgnoreCase(),
        type.getInternalName() + keySuffix,
        comparison.getValues()));
  }
  return subQuery;
}

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

/**
 * Returns SearchResultSelections that are accessible to the specified {@link ToolUser}, optionally excluding selections
 * that were created by the user.
 * @param user the {@link ToolUser} for which SearchResultSelections should be returned.
 * @param excludeOwn excludes selections created by the specified {@link ToolUser} if true.
 * @return accessible {@link SearchResultSelection}s for the specified {@link ToolUser}.
 */
public static List<SearchResultSelection> findAccessibleSelections(ToolUser user, boolean excludeOwn) {
  if (user == null) {
    return null;
  }
  Query<SearchResultSelection> query = Query.from(SearchResultSelection.class);
  if (user.getRole() == null) {
    query.where("entities != missing");
  } else {
    query.where("entities = ?", user.getRole());
  }
  if (excludeOwn) {
    query.and("entities != ?", user);
  } else {
    query.or("entities = ?", user);
  }
  return query.selectAll();
}

相关文章