where_clause.append(")");
}
catch (MolgenisModelException e)
{
throw new DatabaseException(e);
}
}
else if (rule.getOperator() == QueryRule.Operator.NESTED)
{
QueryRule[] nestedrules = rule.getNestedRules();
if (nestedrules.length > 0)
{
if (where_clause.length() > 0)
{
if (previousRule != null && Operator.OR.equals(previousRule.getOperator()))
{
where_clause.append(" OR ");
}
else
{
where_clause.append(" AND ");
}
}
where_clause.append("(");
where_clause.append(createWhereSql(true, false, nestedrules));
where_clause.append(")");
}
}
// experimental: subqery
else if (rule.getOperator() == QueryRule.Operator.IN_SUBQUERY)
{
if (where_clause.length() > 0)
{
if (previousRule != null && Operator.OR.equals(previousRule.getOperator()))
{
where_clause.append(" OR ");
}
else
{
where_clause.append(" AND ");
}
}
where_clause.append(rule.getField() + " IN(" + rule.getValue() + ")");
}
else if (rule.getOperator() == QueryRule.Operator.IN)
{
// only add if nonempty condition???
if (rule.getValue() == null
|| (rule.getValue() instanceof List<?> && ((List<?>) rule.getValue()).size() == 0)
|| (rule.getValue() instanceof Object[] && ((Object[]) rule.getValue()).length == 0)) throw new DatabaseException(
"empty 'in' clause for rule " + rule);
{
if (where_clause.length() > 0)
{
if (previousRule != null && Operator.OR.equals(previousRule.getOperator()))