use of org.unipop.process.predicate.ExistsP in project unipop by unipop-graph.
the class FilterHelper method createFilter.
public static QueryBuilder createFilter(HasContainer container) {
String key = container.getKey();
P predicate = container.getPredicate();
Object value = predicate.getValue();
BiPredicate<?, ?> biPredicate = predicate.getBiPredicate();
if (key.equals("_id"))
return getIdsFilter(value);
else if (key.equals("_type"))
return getTypeFilter(container);
else if (predicate instanceof ConnectiveP) {
return handleConnectiveP(key, (ConnectiveP) predicate);
} else if (biPredicate != null) {
return predicateToQuery(key, value, biPredicate);
} else if (predicate instanceof ExistsP)
return QueryBuilders.existsQuery(key);
else
throw new IllegalArgumentException("HasContainer not supported by unipop");
}
use of org.unipop.process.predicate.ExistsP in project unipop by unipop-graph.
the class JdbcPredicatesTranslator method extractCondition.
private Condition extractCondition(HasContainer hasContainer) {
String key = hasContainer.getKey();
P predicate = hasContainer.getPredicate();
Object value = predicate.getValue();
BiPredicate<?, ?> biPredicate = predicate.getBiPredicate();
Field<Object> field = field(key);
if (predicate instanceof ConnectiveP) {
return handleConnectiveP(key, (ConnectiveP) predicate);
} else if (predicate instanceof ExistsP) {
return field.isNotNull();
} else
return predicateToQuery(key, value, biPredicate);
}
Aggregations