use of com.querydsl.core.types.dsl.BooleanExpression in project Settler by EmhyrVarEmreis.
the class PermissionManagerImplementation method isAuthorized.
@Override
public boolean isAuthorized(Long sourceId, Long targetId, OperationType operationType) {
BooleanExpression expression = jTBObjectHierarchy.objectFrom.id.eq(jTBObjectPrivilege.objectTo.id).and(jTBObjectHierarchy.objectTo.id.eq(targetId));
expression = expression.or(jTBObjectPrivilege.objectTo.id.eq(targetId));
expression = expression.or(jTBObjectPrivilege.objectTo.isNull());
return new JPAQuery<Void>(entityManager).select(Expressions.ONE).from(jTBObjectPrivilege, jTBObjectHierarchy).where(jTBObjectPrivilege.objectFrom.id.eq(sourceId), (jTBObjectPrivilege.operationType.eq(operationType)), expression).fetchFirst() != null;
}
use of com.querydsl.core.types.dsl.BooleanExpression in project jeeshop by remibantos.
the class CatalogItemFinder method buildSearchPredicate.
private BooleanExpression buildSearchPredicate(String search, QCatalogItem qCatalogItem) {
BooleanExpression searchPredicate = qCatalogItem.name.containsIgnoreCase(search).or(qCatalogItem.description.containsIgnoreCase(search));
if (NumberUtils.isNumber(search)) {
Long searchId = Long.parseLong(search);
searchPredicate = qCatalogItem.id.eq(searchId);
}
return searchPredicate;
}
use of com.querydsl.core.types.dsl.BooleanExpression in project tutorials by eugenp.
the class MyUserPredicatesBuilder method build.
public BooleanExpression build() {
if (params.size() == 0) {
return null;
}
final List<BooleanExpression> predicates = new ArrayList<>();
MyUserPredicate predicate;
for (final SearchCriteria param : params) {
predicate = new MyUserPredicate(param);
final BooleanExpression exp = predicate.getPredicate();
if (exp != null) {
predicates.add(exp);
}
}
BooleanExpression result = predicates.get(0);
for (int i = 1; i < predicates.size(); i++) {
result = result.and(predicates.get(i));
}
return result;
}
use of com.querydsl.core.types.dsl.BooleanExpression in project modesti by jlsalmon.
the class PredicateBuilder method build.
public BooleanExpression build() {
if (params.size() == 0) {
return null;
}
List<BooleanExpression> predicates = new ArrayList<>();
Predicate<T> predicate;
for (SearchCriteria param : params) {
predicate = new Predicate<>(param, klass);
BooleanExpression exp = predicate.getPredicate();
if (exp != null) {
predicates.add(exp);
}
}
BooleanExpression result = predicates.get(0);
for (int i = 1; i < predicates.size(); i++) {
result = result.and(predicates.get(i));
}
return result;
}
use of com.querydsl.core.types.dsl.BooleanExpression in project modesti by jlsalmon.
the class RsqlExpressionBuilder method createExpression.
private BooleanExpression createExpression(final LogicalNode logicalNode) {
List<BooleanExpression> expressions = new ArrayList<>();
BooleanExpression temp;
for (final Node node : logicalNode.getChildren()) {
temp = createExpression(node);
if (temp != null) {
expressions.add(temp);
}
}
BooleanExpression result = expressions.get(0);
if (logicalNode.getOperator() == LogicalOperator.AND) {
for (int i = 1; i < expressions.size(); i++) {
result = result.and(expressions.get(i));
}
} else if (logicalNode.getOperator() == LogicalOperator.OR) {
for (int i = 1; i < expressions.size(); i++) {
result = result.or(expressions.get(i));
}
}
return result;
}
Aggregations