/** * Create an expression to represent one of the nodes on a SetToNode. * We will assume that set_to nodes change elements that are direct mappings on the reference * class of the query. */ protected Expression getExpressionForNode(Node node, Class referenceClass, GenerationContext context) { Expression expression = null; if (node.isAttributeNode()) { // look up a preexisting expression based on the reference class of the query. String classVariable = context.getParseTreeContext().getVariableNameForClass(referenceClass, context); expression = context.expressionFor(classVariable); if (expression == null) { expression = new ExpressionBuilder(); context.addExpression(expression, classVariable); } expression = node.addToExpression(expression, context); } else { expression = node.generateExpression(context); } return expression; }
/** * Create an expression to represent one of the nodes on a SetToNode. * We will assume that set_to nodes change elements that are direct mappings on the reference * class of the query. */ protected Expression getExpressionForNode(Node node, Class referenceClass, GenerationContext context) { Expression expression = null; if (node.isAttributeNode()) { // look up a preexisting expression based on the reference class of the query. String classVariable = context.getParseTreeContext().getVariableNameForClass(referenceClass, context); expression = context.expressionFor(classVariable); if (expression == null) { expression = new ExpressionBuilder(); context.addExpression(expression, classVariable); } expression = node.addToExpression(expression, context); } else { expression = node.generateExpression(context); } return expression; }
/** * Create an expression to represent one of the nodes on a SetToNode. * We will assume that set_to nodes change elements that are direct mappings on the reference * class of the query. */ protected Expression getExpressionForNode(Node node, Class referenceClass, GenerationContext context) { Expression expression = null; if (node.isAttributeNode()) { // look up a preexisting expression based on the reference class of the query. String classVariable = context.getParseTreeContext().getVariableNameForClass(referenceClass, context); expression = context.expressionFor(classVariable); if (expression == null) { expression = new ExpressionBuilder(); context.addExpression(expression, classVariable); } expression = node.addToExpression(expression, context); } else { expression = node.generateExpression(context); } return expression; }
/** * INTERNAL * Return a TopLink expression by getting the required variables using the * left and right nodes * "emp.address.city" = builder.get("address").get("city") */ public Expression generateExpression(GenerationContext context) { Node right = getRight(); if (enumConstant != null) { // enum literal access return new ConstantExpression(enumConstant, new ExpressionBuilder()); } else { // Get the left expression Expression whereClause = getLeft().generateExpression(context); // Calculate the mapping and pass it to the right expression if (right.isAttributeNode()) { ((AttributeNode)right).setMapping(resolveMapping(context)); } // Or it with whatever the right expression is whereClause = right.addToExpression(whereClause, context); if (alias != null){ context.addExpression(whereClause, alias); } // and return the expression... return whereClause; } }
/** * INTERNAL * Return a TopLink expression by getting the required variables using the * left and right nodes * "emp.address.city" = builder.get("address").get("city") */ public Expression generateExpression(GenerationContext context) { Node right = getRight(); if (enumConstant != null) { // enum literal access return new ConstantExpression(enumConstant, new ExpressionBuilder()); } else { // Get the left expression Expression whereClause = getLeft().generateExpression(context); // Calculate the mapping and pass it to the right expression if (right.isAttributeNode()) { ((AttributeNode)right).setMapping(resolveMapping(context)); } // Or it with whatever the right expression is whereClause = right.addToExpression(whereClause, context); if (alias != null){ context.addExpression(whereClause, alias); } // and return the expression... return whereClause; } }
if (right.isAttributeNode()) { ((AttributeNode)right).setMapping(resolveMapping(context));
name, typeHelper.getTypeName(left.getType())); if (right.isAttributeNode()){ type = ((AttributeNode)right).computeActualType(type, typeHelper); ((AttributeNode)right).checkForQueryKey(left.getType(), typeHelper);
name, typeHelper.getTypeName(left.getType())); if (right.isAttributeNode()){ type = ((AttributeNode)right).computeActualType(type, typeHelper); ((AttributeNode)right).checkForQueryKey(left.getType(), typeHelper);