row.put("$or", nested);
} else {
throw new EISException("Query too complex for Mongo translation, logic [" + expression + "] not supported in query: " + query);
}
} else if (expression.isFunctionExpression()) {
FunctionExpression function = (FunctionExpression)expression;
if (function.getOperator().getSelector() == ExpressionOperator.Like) {
Object left = extractValueFromExpression((Expression)function.getChildren().get(0), query);
Object right = extractValueFromExpression((Expression)function.getChildren().get(1), query);
if (!(right instanceof String)) {
throw new EISException("Query too complex for Mongo translation, like with [" + right + "] not supported in query: " + query);
}
String pattern = (String)right;
DatabaseRecord nested = new DatabaseRecord();
if (!this.isLikeRegex) {
pattern = Helper.convertLikeToRegex(pattern);
}
nested.put("$regex", pattern);
row.put(left, nested);
} else if (function.getOperator().getSelector() == ExpressionOperator.Not) {
DatabaseRecord nested = new DatabaseRecord();
appendExpressionToQueryRow((Expression)function.getChildren().get(0), nested, query);
row.put("$not", nested);
} else {
throw new EISException("Query too complex for Mongo translation, function [" + expression + "] not supported in query: " + query);
}
} else {