LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing compare criteria."); //$NON-NLS-1$
Comparison.Operator op = ((Comparison) criteria).getOperator();
isNegated = op == Operator.NE || op == Operator.GT || op == Operator.LT;
Expression lhs = ((Comparison) criteria).getLeftExpression();
Expression rhs = ((Comparison) criteria).getRightExpression();
String lhsString = getExpressionString(lhs);
String rhsString = getExpressionString(rhs);
if(lhsString == null || rhsString == null) {
final String msg = LDAPPlugin.Util.getString("IQueryToLdapSearchParser.missingNISError"); //$NON-NLS-1$
throw new TranslatorException(msg);
}
addCompareCriteriaToList(filterList, op, lhsString, rhsString);
// Base case
} else if(criteria instanceof Exists) {
LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing EXISTS criteria: NOT IMPLEMENTED YET"); //$NON-NLS-1$
// TODO Exists should be supported in a future release.
// Base case
} else if(criteria instanceof Like) {
LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing LIKE criteria."); //$NON-NLS-1$
isNegated = ((Like) criteria).isNegated();
// Convert LIKE to Equals, where any "%" symbol is replaced with "*".
Comparison.Operator op = Operator.EQ;
Expression lhs = ((Like) criteria).getLeftExpression();
Expression rhs = ((Like) criteria).getRightExpression();
String lhsString = getExpressionString(lhs);
String rhsString = getExpressionString(rhs);
rhsString = rhsString.replace("%", "*"); //$NON-NLS-1$ //$NON-NLS-2$
addCompareCriteriaToList(filterList, op, lhsString, rhsString);
// Base case
} else if(criteria instanceof In) {
LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing IN criteria."); //$NON-NLS-1$
isNegated = ((In) criteria).isNegated();
Expression lhs = ((In)criteria).getLeftExpression();
List<Expression> rhsList = ((In)criteria).getRightExpressions();
// Recursively add each IN expression to the filter list.
processInCriteriaList(filterList, rhsList, lhs);
} else if (criteria instanceof Not) {
LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Parsing NOT criteria."); //$NON-NLS-1$