if (expression.getType() == Token.GETPROP && expression.getFirstChild().getType() == Token.GETPROP && expression.getFirstChild().getFirstChild().getType() == Token.THIS
&& "id".equals(expression.getLastChild().getString())) {
name = expression.getFirstChild().getLastChild().getString();
sql.append("field='" + makeStringSQLSafe(name) + "'");
if (valueNode.getType() != Token.STRING || (conditionType != Token.EQ && conditionType != Token.SHEQ))
throw new QueryCantBeHandled("The id must be a string");
Identification id = Identification.idForString(valueNode.getString());
if (!(id instanceof ObjectId)){
throw new QueryCantBeHandled("The id must be an object id");
}
if(!(id.source instanceof DynaObjectDBSource)){
throw new QueryCantBeHandled("The id must be an object id of the object db");
}
sql.append(" AND value_type=" + OBJECT_TYPE + " AND value=" + ((DynaObjectDBSource)id.source).convertId(id.subObjectId));
return sql.toString();
}
if (expression.getType() == Token.GETPROP && expression.getFirstChild().getType() == Token.THIS
&& "id".equals(expression.getLastChild().getString())) {
Identification id = Identification.idForString(valueNode.getString());
if (!(id instanceof ObjectId)){
throw new QueryCantBeHandled("The id must be an object id");
}
if(!(id.source instanceof DynaObjectDBSource)){
throw new QueryCantBeHandled("The id must be an object id of the object db");
}
sql.append("id=" + + ((DynaObjectDBSource)id.source).convertId(id.subObjectId));
return sql.toString();
}
return super.comparison(expression, valueNode, conditionType);