String modelClassName = tree.getChild(0).getText();
ModelClassBase modelClass = getDB().getModelClass(modelClassName);
MultiModelItem item = add(new MultiModelItem(this, modelClass, makeItemName(modelClass)));
return new MultiModelNode(item);
} else if (tree.getType() == ExprParser.RIGHT_JOIN) {
ExpressionNode operand1 = visit(tree.getChild(0));
ExpressionNode operand2 = visit(tree.getChild(1));
String[] keys = calcRestrictionKeys(getMultiModelItems(operand2), getMultiModelItems(operand1));
keys = keys != null ? keys : calcRestrictionKeys(getMultiModelItems(operand1), getMultiModelItems(operand2));
RightJoin join = new RightJoin(operand1, operand2, fields.get(keys[0]), fields.get(keys[1]));
operations.add(join);
return join;
} else if (tree.getType() == ExprParser.LEFT_JOIN) {
ExpressionNode operand1 = visit(tree.getChild(0));
ExpressionNode operand2 = visit(tree.getChild(1));
String[] keys = calcRestrictionKeys(getMultiModelItems(operand1), getMultiModelItems(operand2));
keys = keys != null ? keys : calcRestrictionKeys(getMultiModelItems(operand2), getMultiModelItems(operand1));
LeftJoin join = new LeftJoin(operand1, operand2, fields.get(keys[0]), fields.get(keys[1]));
operations.add(join);
return join;
} else if (tree.getType() == ExprParser.FULL_JOIN) {
ExpressionNode operand1 = visit(tree.getChild(0));
ExpressionNode operand2 = visit(tree.getChild(1));
String[] keys = calcRestrictionKeys(getMultiModelItems(operand1), getMultiModelItems(operand2));
keys = keys != null ? keys : calcRestrictionKeys(getMultiModelItems(operand2), getMultiModelItems(operand1));
FullJoin join = new FullJoin(operand1, operand2, fields.get(keys[0]), fields.get(keys[1]));
operations.add(join);
return join;
} else if (tree.getType() == ExprParser.INNER_JOIN) {
ExpressionNode operand1 = visit(tree.getChild(0));
ExpressionNode operand2 = visit(tree.getChild(1));
String[] keys = calcRestrictionKeys(getMultiModelItems(operand1), getMultiModelItems(operand2));
keys = keys != null ? keys : calcRestrictionKeys(getMultiModelItems(operand2), getMultiModelItems(operand1));
InnerJoin join = new InnerJoin(operand1, operand2, fields.get(keys[0]), fields.get(keys[1]));
operations.add(join);
return join;
} else if (tree.getType() == ExprParser.AND) {
ExpressionNode operand1 = visit(tree.getChild(0));
ExpressionNode operand2 = visit(tree.getChild(1));
return new And(operand1, operand2);
}
return null;
}