/** * INTERNAL * Validate the current node. */ public void validate(ParseTreeContext context, SelectNode selectNode) { for (Iterator i = groupByItems.iterator(); i.hasNext(); ) { Node item = (Node)i.next(); item.validate(context); } List selectExprs = selectNode.getSelectExpressions(); // check select expressions for (Iterator i = selectExprs.iterator(); i.hasNext(); ) { Node selectExpr = (Node)i.next(); if (!isValidSelectExpr(selectExpr)) { throw JPQLException.invalidSelectForGroupByQuery( context.getQueryInfo(), selectExpr.getLine(), selectExpr.getColumn(), selectExpr.getAsString(), getAsString()); } } }
/** * INTERNAL * Validate the current node. */ public void validate(ParseTreeContext context, GroupByNode groupbyNode) { if (having != null) { having.validate(context); if ((groupbyNode != null) && !groupbyNode.isValidHavingExpr(having)) { throw JPQLException.invalidHavingExpression( context.getQueryInfo(), having.getLine(), having.getColumn(), having.getAsString(), groupbyNode.getAsString()); } } }
/** * INTERNAL * Validate the current node and calculates its type. */ public void validate(ParseTreeContext context) { Object leftType = null; TypeHelper typeHelper = context.getTypeHelper(); if (left != null) { left.validate(context); // check to see if the argument is a parameter if (isListParameterOrSubquery && !getTheObjects().isEmpty() && ((Node)getTheObjects().get(0)).isParameterNode()){ leftType = Collection.class; } else { leftType = left.getType(); } } for (Iterator i = getTheObjects().iterator(); i.hasNext();) { Node node = (Node)i.next(); node.validate(context); node.validateParameter(context, leftType); Object nodeType = node.getType(); if ((leftType != null) && !typeHelper.isAssignableFrom(leftType, nodeType)) throw JPQLException.invalidExpressionArgument( context.getQueryInfo(), node.getLine(), node.getColumn(), "IN", node.getAsString(), typeHelper.getTypeName(leftType)); } setType(typeHelper.getBooleanType()); }
/** * INTERNAL * Validate the current node and calculates its type. */ public void validate(ParseTreeContext context) { Object leftType = null; TypeHelper typeHelper = context.getTypeHelper(); if (left != null) { left.validate(context); // check to see if the argument is a parameter if (isListParameterOrSubquery && !getTheObjects().isEmpty() && ((Node)getTheObjects().get(0)).isParameterNode()){ leftType = Collection.class; } else { leftType = left.getType(); } } for (Iterator i = getTheObjects().iterator(); i.hasNext();) { Node node = (Node)i.next(); node.validate(context); node.validateParameter(context, leftType); Object nodeType = node.getType(); if ((leftType != null) && !typeHelper.isAssignableFrom(leftType, nodeType)) throw JPQLException.invalidExpressionArgument( context.getQueryInfo(), node.getLine(), node.getColumn(), "IN", node.getAsString(), typeHelper.getTypeName(leftType)); } setType(typeHelper.getBooleanType()); }
/** * INTERNAL * Validate the current node and calculates its type. */ public void validate(ParseTreeContext context) { Object leftType = null; TypeHelper typeHelper = context.getTypeHelper(); if (left != null) { left.validate(context); // check to see if the argument is a parameter if (isListParameterOrSubquery && !getTheObjects().isEmpty() && ((Node)getTheObjects().get(0)).isParameterNode()){ leftType = Collection.class; } else { leftType = left.getType(); } } for (Iterator i = getTheObjects().iterator(); i.hasNext();) { Node node = (Node)i.next(); node.validate(context); node.validateParameter(context, leftType); Object nodeType = node.getType(); if ((leftType != null) && !typeHelper.isAssignableFrom(leftType, nodeType)) throw JPQLException.invalidExpressionArgument( context.getQueryInfo(), node.getLine(), node.getColumn(), "IN", node.getAsString(), typeHelper.getTypeName(leftType)); } setType(typeHelper.getBooleanType()); }
/** * INTERNAL * Validate node and calculate its type. */ public void validate(ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); if (left != null) { left.validate(context); left.validateParameter(context, typeHelper.getIntType()); Object type = left.getType(); if (!typeHelper.isIntegralType(type)) throw JPQLException.invalidFunctionArgument( context.getQueryInfo(), left.getLine(), left.getColumn(), "MOD", left.getAsString(), "integral type"); } if (denominator != null) { denominator.validate(context); denominator.validateParameter(context, typeHelper.getIntType()); Object denominatorType = denominator.getType(); if (!typeHelper.isIntegralType(denominatorType)) throw JPQLException.invalidFunctionArgument( context.getQueryInfo(), denominator.getLine(), denominator.getColumn(), "MOD", denominator.getAsString(), "integral type"); } setType(typeHelper.getIntType()); }
/** * INTERNAL * Validate node and calculate its type. */ public void validate(ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); if (left != null) { left.validate(context); left.validateParameter(context, typeHelper.getIntType()); Object type = left.getType(); if (!typeHelper.isIntegralType(type)) throw JPQLException.invalidFunctionArgument( context.getQueryInfo(), left.getLine(), left.getColumn(), "MOD", left.getAsString(), "integral type"); } if (denominator != null) { denominator.validate(context); denominator.validateParameter(context, typeHelper.getIntType()); Object denominatorType = denominator.getType(); if (!typeHelper.isIntegralType(denominatorType)) throw JPQLException.invalidFunctionArgument( context.getQueryInfo(), denominator.getLine(), denominator.getColumn(), "MOD", denominator.getAsString(), "integral type"); } setType(typeHelper.getIntType()); }
context.getQueryInfo(), right.getLine(), right.getColumn(), name, typeHelper.getTypeName(left.getType())); if (enumConstant == null) { throw JPQLException.invalidEnumLiteral(context.getQueryInfo(), right.getLine(), right.getColumn(), typeName, name); context.getQueryInfo(), leftMost.getLine(), leftMost.getColumn(), leftMost.getAsString());
/** * INTERNAL * Validate node and calculate its type. */ public void validate(ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); if (left != null) { left.validate(context); left.validateParameter(context, typeHelper.getIntType()); Object type = left.getType(); if (!typeHelper.isIntegralType(type)) throw JPQLException.invalidFunctionArgument( context.getQueryInfo(), left.getLine(), left.getColumn(), "MOD", left.getAsString(), "integral type"); } if (denominator != null) { denominator.validate(context); denominator.validateParameter(context, typeHelper.getIntType()); Object denominatorType = denominator.getType(); if (!typeHelper.isIntegralType(denominatorType)) throw JPQLException.invalidFunctionArgument( context.getQueryInfo(), denominator.getLine(), denominator.getColumn(), "MOD", denominator.getAsString(), "integral type"); } setType(typeHelper.getIntType()); }
/** * INTERNAL * Validate node and calculate its type. */ public void validate(ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); if (orderNode == null){ if (orderByItem instanceof Node){ orderNode = (Node)orderByItem; } else { orderNode = context.pathForVariable((String)orderByItem); if (orderNode == null){ throw JPQLException.nonExistantOrderByAlias( context.getQueryInfo(), getLine(), getColumn(), (String)orderByItem); } } } if (orderNode != null) { orderNode.validate(context); Object type = orderNode.getType(); setType(type); if (!typeHelper.isOrderableType(type)) { throw JPQLException.expectedOrderableOrderByItem( context.getQueryInfo(), orderNode.getLine(), orderNode.getColumn(), orderNode.getAsString(), typeHelper.getTypeName(type)); } } }
/** * INTERNAL * Validate node and calculate its type. */ public void validate(ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); if (orderNode == null){ if (orderByItem instanceof Node){ orderNode = (Node)orderByItem; } else { orderNode = context.pathForVariable((String)orderByItem); if (orderNode == null){ throw JPQLException.nonExistantOrderByAlias( context.getQueryInfo(), getLine(), getColumn(), (String)orderByItem); } } } if (orderNode != null) { orderNode.validate(context); Object type = orderNode.getType(); setType(type); if (!typeHelper.isOrderableType(type)) { throw JPQLException.expectedOrderableOrderByItem( context.getQueryInfo(), orderNode.getLine(), orderNode.getColumn(), orderNode.getAsString(), typeHelper.getTypeName(type)); } } }
context.getQueryInfo(), right.getLine(), right.getColumn(), name, typeHelper.getTypeName(left.getType())); if (enumConstant == null) { throw JPQLException.invalidEnumLiteral(context.getQueryInfo(), right.getLine(), right.getColumn(), typeName, name); context.getQueryInfo(), leftMost.getLine(), leftMost.getColumn(), leftMost.getAsString());
/** * INTERNAL * Validate node and calculate its type. */ public void validate(ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); if (orderNode == null){ if (orderByItem instanceof Node){ orderNode = (Node)orderByItem; } else { orderNode = context.pathForVariable((String)orderByItem); if (orderNode == null){ throw JPQLException.nonExistantOrderByAlias( context.getQueryInfo(), getLine(), getColumn(), (String)orderByItem); } } } if (orderNode != null) { orderNode.validate(context); Object type = orderNode.getType(); setType(type); if (!typeHelper.isOrderableType(type)) { throw JPQLException.expectedOrderableOrderByItem( context.getQueryInfo(), orderNode.getLine(), orderNode.getColumn(), orderNode.getAsString(), typeHelper.getTypeName(type)); } } }
context.getQueryInfo(), right.getLine(), right.getColumn(), name, typeHelper.getTypeName(left.getType())); if (enumConstant == null) { throw JPQLException.invalidEnumLiteral(context.getQueryInfo(), right.getLine(), right.getColumn(), typeName, name); context.getQueryInfo(), leftMost.getLine(), leftMost.getColumn(), leftMost.getAsString());
/** * INTERNAL * Checks whether the left hand side of this dot node is navigable. */ private void checkNavigation(Node node, ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); // Checks whether the type of the dot node allows a navigation. Object type = node.getType(); if (!typeHelper.isEntityClass(type) && !typeHelper.isEmbeddable(type) && !typeHelper.isEnumType(type)) { throw JPQLException.invalidNavigation( context.getQueryInfo(), node.getLine(), node.getColumn(), this.getAsString(), node.getAsString(), typeHelper.getTypeName(type)); } // Special check to disallow collection valued relationships if (node.isDotNode()) { Node left = node.getLeft(); AttributeNode right = (AttributeNode)node.getRight(); if (typeHelper.isCollectionValuedRelationship( left.getType(), right.getAttributeName())) { throw JPQLException.invalidCollectionNavigation( context.getQueryInfo(), right.getLine(), right.getColumn(), this.getAsString(), right.getAttributeName()); } } }
/** * INTERNAL * Checks whether the left hand side of this dot node is navigable. */ private void checkNavigation(Node node, ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); // Checks whether the type of the dot node allows a navigation. Object type = node.getType(); if (!typeHelper.isEntityClass(type) && !typeHelper.isEmbeddable(type) && !typeHelper.isEnumType(type)) { throw JPQLException.invalidNavigation( context.getQueryInfo(), node.getLine(), node.getColumn(), this.getAsString(), node.getAsString(), typeHelper.getTypeName(type)); } // Special check to disallow collection valued relationships if (node.isDotNode()) { Node left = node.getLeft(); AttributeNode right = (AttributeNode)node.getRight(); if (typeHelper.isCollectionValuedRelationship( left.getType(), right.getAttributeName())) { throw JPQLException.invalidCollectionNavigation( context.getQueryInfo(), right.getLine(), right.getColumn(), this.getAsString(), right.getAttributeName()); } } }
/** * INTERNAL * Checks whether the left hand side of this dot node is navigable. */ private void checkNavigation(Node node, ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); // Checks whether the type of the dot node allows a navigation. Object type = node.getType(); if (!typeHelper.isEntityClass(type) && !typeHelper.isEmbeddable(type) && !typeHelper.isEnumType(type)) { throw JPQLException.invalidNavigation( context.getQueryInfo(), node.getLine(), node.getColumn(), this.getAsString(), node.getAsString(), typeHelper.getTypeName(type)); } // Special check to disallow collection valued relationships if (node.isDotNode()) { Node left = node.getLeft(); AttributeNode right = (AttributeNode)node.getRight(); if (typeHelper.isCollectionValuedRelationship( left.getType(), right.getAttributeName())) { throw JPQLException.invalidCollectionNavigation( context.getQueryInfo(), right.getLine(), right.getColumn(), this.getAsString(), right.getAttributeName()); } } }