Search in sources :

Example 1 with KapuaAttributePredicate

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;
}
Also used : KapuaAndPredicate(org.eclipse.kapua.model.query.predicate.KapuaAndPredicate) KapuaOrPredicate(org.eclipse.kapua.model.query.predicate.KapuaOrPredicate) KapuaAttributePredicate(org.eclipse.kapua.model.query.predicate.KapuaAttributePredicate)

Aggregations

KapuaAndPredicate (org.eclipse.kapua.model.query.predicate.KapuaAndPredicate)1 KapuaAttributePredicate (org.eclipse.kapua.model.query.predicate.KapuaAttributePredicate)1 KapuaOrPredicate (org.eclipse.kapua.model.query.predicate.KapuaOrPredicate)1