本文整理了Java中com.psddev.dari.db.Query.or
方法的一些代码示例,展示了Query.or
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.or
方法的具体详情如下:
包路径:com.psddev.dari.db.Query
类名称: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();
}
内容来源于网络,如有侵权,请联系作者删除!