@Override
public void visit(Join expression) {
if (expression.hasIdentificationVariable()) {
IdentificationVariable identificationVariable = (IdentificationVariable) expression.getIdentificationVariable();
Expression queryExpression = addNonFetchJoinedAttribute(expression, identificationVariable);
// Add the ON clause to the expression
if (expression.hasOnClause()) {
Expression onClause = queryContext.buildExpression(expression.getOnClause());
// Create the JOIN expression using the base Expression
if (expression.isLeftJoin()) {
queryExpression = baseExpression.leftJoin(queryExpression, onClause);
}
else {
queryExpression = baseExpression.join(queryExpression, onClause);
}
}
// Add the FETCH expression to the Expression
if (expression.hasFetch()) {
String variableName = identificationVariable.getVariableName();
queryExpression = queryContext.getQueryExpression(variableName);
if (queryExpression == null) {
queryExpression = queryContext.buildExpression(expression);
queryContext.addQueryExpression(variableName, queryExpression);