}
}
if (symtbl.getSymbol(classAlias) == null)
{
// Add symbol for this candidate under its alias
symtbl.addSymbol(new PropertySymbol(classAlias, cls));
}
}
Iterator childIter = node[i].getChildNodes().iterator();
while (childIter.hasNext())
{
// Add entries in symbol table for any joined aliases
Node childNode = (Node)childIter.next();
if (childNode.getNodeType() == NodeType.OPERATOR)
{
Node joinedNode = childNode.getFirstChild();
String joinedAlias = (String)joinedNode.getNodeValue();
Symbol joinedSym =
(caseSensitiveAliases ? symtbl.getSymbol(joinedAlias) : symtbl.getSymbolIgnoreCase(joinedAlias));
if (joinedSym == null)
{
throw new QueryCompilerSyntaxException("FROM clause has identifier " + joinedNode.getNodeValue() + " but this is unknown");
}
AbstractClassMetaData joinedCmd = metaDataManager.getMetaDataForClass(joinedSym.getValueType(), clr);
Class joinedCls = joinedSym.getValueType();
while (joinedNode.getFirstChild() != null)
{
joinedNode = joinedNode.getFirstChild();
String joinedMember = (String)joinedNode.getNodeValue();
AbstractMemberMetaData mmd = joinedCmd.getMetaDataForMember(joinedMember);
if (mmd == null)
{
throw new QueryCompilerSyntaxException("FROM clause has reference to " + joinedCmd.getFullClassName() + "." + joinedMember + " but it doesn't exist!");
}
int relationType = mmd.getRelationType(clr);
switch (relationType)
{
case Relation.ONE_TO_ONE_UNI:
case Relation.ONE_TO_ONE_BI:
case Relation.MANY_TO_ONE_BI:
joinedCls = mmd.getType();
joinedCmd = metaDataManager.getMetaDataForClass(joinedCls, clr);
break;
case Relation.ONE_TO_MANY_UNI:
case Relation.ONE_TO_MANY_BI:
case Relation.MANY_TO_MANY_BI:
if (mmd.hasCollection())
{
// TODO Don't currently allow interface field navigation
joinedCmd = mmd.getCollection().getElementClassMetaData(clr, metaDataManager);
joinedCls = clr.classForName(joinedCmd.getFullClassName());
}
else if (mmd.hasArray())
{
// TODO Don't currently allow interface field navigation
joinedCmd = mmd.getArray().getElementClassMetaData(clr, metaDataManager);
joinedCls = clr.classForName(joinedCmd.getFullClassName());
}
break;
default:
break;
}
}
Node aliasNode = childNode.getNextChild();
if (aliasNode.getNodeType() == NodeType.NAME)
{
symtbl.addSymbol(new PropertySymbol((String)aliasNode.getNodeValue(), joinedCls));
}
}
}
boolean classIsExpression = false;