final ComplexFilter filter = (ComplexFilter) f.value;
final Filter[] parseValue = filter.field.parseValue(filter);
if (parseValue != null) {
return new ReificationRequest(new SimpleRequest(
filter.field.keyKind, new Query(parseValue,
new Sort("", false), limit, 0), limit),
limit) {
protected IComplexQueryRequest toQuery(Object object) {
Entity e = (Entity) object;
Key key = e.getKey();
return new SimpleRequest(kind, new Query(
new Filter[] { new Filter(
filter.field.name, Filter.EQUAL,
key) }, new Sort("", true), 100,
100), 100);
}
public void filter(HashSet<Object> r) {
waitWhileNotDone();
HashSet<Object> toREtain = new HashSet<Object>();
for (Object o : r) {
Entity e = (Entity) o;
String fName = filter.field.name;
Object property = e.getProperty(fName);
if (fName.equals(Entity.KEY_RESERVED_PROPERTY)) {
property = e.getKey();
}
if (property instanceof Collection) {
Collection c = (Collection) property;
for (Object o1 : c) {
if (matching.contains(property)) {
toREtain.add(o1);
break;
}
}
} else {
if (matching.contains(property)) {
toREtain.add(o);
}
}
}
r.retainAll(toREtain);
}
};
}
return null;
}
return new SimpleRequest(kind, new Query(new Filter[] { f },
new Sort("", false), limit, 0), limit);
}