use of org.eclipse.kapua.model.query.predicate.KapuaAttributePredicate in project kapua by eclipse.
the class ServiceDAO method handleKapuaQueryPredicates.
/**
* Criteria for query entity utility method
*
* @param qp
* @param binds
* @param cb
* @param userPermissionRoot
* @param entityType
* @return
* @throws KapuaException
*/
@SuppressWarnings("rawtypes")
protected static <E> Expression<Boolean> handleKapuaQueryPredicates(KapuaPredicate qp, Map<ParameterExpression, Object> binds, CriteriaBuilder cb, Root<E> userPermissionRoot, EntityType<E> entityType) throws KapuaException {
Expression<Boolean> expr = null;
if (qp instanceof KapuaAttributePredicate) {
KapuaAttributePredicate attrPred = (KapuaAttributePredicate) qp;
expr = handleAttributePredicate(attrPred, binds, cb, userPermissionRoot, entityType);
} else if (qp instanceof KapuaAndPredicate) {
KapuaAndPredicate andPredicate = (KapuaAndPredicate) qp;
expr = handleAndPredicate(andPredicate, binds, cb, userPermissionRoot, entityType);
} else if (qp instanceof KapuaOrPredicate) {
KapuaOrPredicate andPredicate = (KapuaOrPredicate) qp;
expr = handleOrPredicate(andPredicate, binds, cb, userPermissionRoot, entityType);
}
return expr;
}
Aggregations