if (o instanceof ParameterOperand) {
//myParam.contains(...)
if (debug) {
logger.log(BasicLevel.DEBUG, tab + "(" + name + ") InCollection (" + o + ")");
}
Field qtf = (Field) fields.get(name);
Expression e = new InCollection(
new BasicFieldOperand(qtf),
(ParameterOperand) o, qtf.getType());
stack.push(e);
} else if (o instanceof String) {
String pathset = (String) o;
String[] spli = splitPath(pathset);
if (vars.containsKey(splitted[0])) {
//x.y.bs.contains(b)
//The variable definition is managed by the Variable visitor
//thus forget the expression
if ((nbNot % 2) == 0) {
stack.push(REMOVER);
} else {
QueryTreeField f = (QueryTreeField) fields.get(name);
stack.push(new Not(new IsEmpty(new BasicFieldOperand(f))));
}
} else {
//x.y.bs.contains(u.v.b)
String rest = mergePath(spli, 1, spli.length - 2);
QueryBuilder subquery = new QueryBuilder(qb);
subquery.define("", qb.navigate(spli[0]));
QueryTreeField setField = subquery.project(subquery.navigate(rest));
QueryTreeField f = (QueryTreeField) fields.get(name);
stack.push(new MemberOf(
Collections.singletonList(
new BasicFieldOperand(f)),
Collections.singletonList(
new BasicFieldOperand(setField))
));
}
} else {
if (debug) {
logger.log(BasicLevel.DEBUG, tab + "Do not use the pathset of the contain operator");
}
stack.push(REMOVER);
}
return;
}
//maybe there is an operator
String last = splitted[splitted.length - 1];
operatorId = isMethodOperator(last);
if (operatorId == -1) {
//No operator found ==> default case
if (debug) {
logger.log(BasicLevel.DEBUG, tab + "create a fieldOperand with:" + name);
}
Field f = (Field) fields.get(name);
if (f == null) {
throw new SpeedoException("Internal error: No field '" + name + "' found during filter parsing");
}
stack.push(new BasicFieldOperand(f));
return;
}
//There is an operator
String begin = buildStringwithout(splitted, splitted.length-1, ".");
if (operatorId == CONTAINS_OPERATOR) {
//The contains contraint is managed during the QueryTree creation
//see the variable vistor
//However push some stuff in the stack in order to known that
// the next qualifiedName is used in a contain constraint.
if (debug) {
logger.log(BasicLevel.DEBUG, tab + "contains operator: set=" + begin);
}
stack.push(begin);
stack.push(CONTAINS_PATH_SET);
return;
} else if (operatorId == IS_EMPTY_OPERATOR) {
if (debug) {
logger.log(BasicLevel.DEBUG, tab + "Visit IsEmpty: " + begin);
}
String rest = mergePath(splitted, 1, splitted.length - 2);
QueryBuilder subquery = new QueryBuilder(qb);
subquery.define("", qb.navigate(splitted[0]));
Field f = subquery.project(subquery.navigate(rest));
stack.push(new IsEmpty(new BasicFieldOperand(f)));
return;
}
if (debug) {
logger.log(BasicLevel.DEBUG, tab + "create a fieldOperand with:" + begin);
}
Field f = (Field) fields.get(begin);
Expression e = new BasicFieldOperand(f);
switch (operatorId) {
case TO_LOWER_OPERATOR:
e = new StringLower(e);
stack.push(e);