NoSqlPredicate convertPredicate(IPredicate predicate, String tableName, Map<String,Comparable<?>> parameterMap) {
if (predicate == null)
return null;
NoSqlPredicate convertedPredicate = null;
if (predicate instanceof CompoundPredicate) {
CompoundPredicate compoundPredicate = (CompoundPredicate)predicate;
ArrayList<NoSqlPredicate> noSqlPredicateList = new ArrayList<NoSqlPredicate>();
for (IPredicate childPredicate: compoundPredicate.getPredicateList()) {
boolean incorporated = false;
if (childPredicate instanceof OperatorPredicate) {
OperatorPredicate childOperatorPredicate = (OperatorPredicate)childPredicate;
for (NoSqlPredicate childNoSqlPredicate: noSqlPredicateList) {
incorporated = childNoSqlPredicate.incorporateComparison(
childOperatorPredicate.getColumnName(), childOperatorPredicate.getOperator(),
getOperatorPredicateValue(childOperatorPredicate, parameterMap),
compoundPredicate.getOperator());
if (incorporated)
break;
}
}
if (!incorporated) {
NoSqlPredicate noSqlPredicate = convertPredicate(childPredicate, tableName, parameterMap);
noSqlPredicateList.add(noSqlPredicate);
}
}
convertedPredicate = new NoSqlCompoundPredicate(this, tableName,
compoundPredicate.getOperator(),
compoundPredicate.isNegated(), noSqlPredicateList);
} else if (predicate instanceof OperatorPredicate) {
OperatorPredicate operatorPredicate = (OperatorPredicate) predicate;
Comparable<?> value = getOperatorPredicateValue(operatorPredicate, parameterMap);
switch (operatorPredicate.getOperator()) {
case EQ: