Fix CONTAINSALL to work with subqueries
Resolves:
@@ -35,7 +35,9 @@ public class OContainsAllCondition extends OBooleanExpression {
public boolean execute(Object left, Object right) {
if (left instanceof Collection) {
if (right instanceof Collection) {
- return ((Collection) left).containsAll((Collection) right);
+ if (((Collection) left).containsAll((Collection) right)) {
+ return true;
+ }
}
if (right instanceof Iterable) {
right = ((Iterable) right).iterator();
@@ -44,10 +46,17 @@ public class OContainsAllCondition extends OBooleanExpression {
Iterator iterator = (Iterator) right;
while (iterator.hasNext()) {
Object next = iterator.next();
- if (!((Collection) left).contains(next)) {
+ boolean found = false;
+ if (((Collection) left).contains(next)) {
+ found = true;
+ } else if (next instanceof OResult && ((OResult) next).isElement() && ((Collection) left).contains(((OResult) next).toElement())) {
+ found = true;
+ }
+ if (!found) {
return false;
}
}
+ return true;
}
return ((Collection) left).contains(right);
}
