SymbExToColumns translator = new SymbExToColumns(metamodel,
new SelectFromWhereLambdaArgumentHandler(where, fromList));
Condition methodExpr = null;
for (int n = 0; n < where.symbolicAnalysis.paths.size(); n++)
{
PathAnalysis path = where.symbolicAnalysis.paths.get(n);
TypedValue returnVal = PathAnalysisSimplifier.simplifyBoolean(path.getReturnValue(), Collections.emptyMap());
ColumnExpressions<?> returnColumns = translator.transform(returnVal);
if (!returnColumns.isSingleColumn()) throw new IllegalArgumentException("Where lambda should only return a single column of data");
QueryPart returnExpr = returnColumns.getOnlyColumn();
if (returnVal instanceof ConstantValue.BooleanConstant)
{
if (((ConstantValue.BooleanConstant)returnVal).val)
{
// This path returns true, so it's redundant to actually
// put true into the final code.
returnExpr = null;
}
else
{
// This path returns false, so we can ignore it
continue;
}
}
// Handle where path conditions
Condition conditionExpr = null;
for (TypedValue cmp: path.getConditions())
{
ColumnExpressions<?> col = translator.transform(cmp);
if (!col.isSingleColumn()) throw new IllegalArgumentException("Expecting a single column");
Condition expr = (Condition)col.getOnlyColumn();
if (conditionExpr != null)