Set<String> keyPropertyIds = new HashSet<String>(provider.getKeyPropertyIds().values());
Request readRequest = PropertyHelper.getReadRequest(keyPropertyIds);
Iterable<Resource> resources = getResources(type, readRequest, predicate);
PredicateBuilder pb = new PredicateBuilder();
PredicateBuilder.PredicateBuilderWithPredicate pbWithPredicate = null;
for (Resource resource : resources) {
if (pbWithPredicate != null) {
pb = pbWithPredicate.or();
}
pb = pb.begin();
pbWithPredicate = null;
for (String keyPropertyId : keyPropertyIds) {
if (pbWithPredicate != null) {
pb = pbWithPredicate.and();
}
pbWithPredicate =
pb.property(keyPropertyId).equals((Comparable) resource.getPropertyValue(keyPropertyId));
}
if (pbWithPredicate != null) {
pbWithPredicate = pbWithPredicate.end();
}
}