/** * INTERNAL * Associate the given schema with the given variable. */ public void registerSchema(String variable, String schema, int line, int column) { VariableDecl decl = (VariableDecl)variableDecls.get(variable); if (decl == null) { decl = new VariableDecl(variable, schema); variableDecls.put(variable, decl); } else { String text = decl.isRangeVariable ? decl.schema : decl.path.getAsString(); throw JPQLException.multipleVariableDeclaration( getQueryInfo(), line, column, variable, text); } }
/** * INTERNAL * Associate the given path with the given variable. */ public void registerJoinVariable(String variable, Node path, int line, int column) { VariableDecl decl = (VariableDecl)variableDecls.get(variable); if (decl == null) { decl = new VariableDecl(variable, path); variableDecls.put(variable, decl); } else { String text = decl.isRangeVariable ? decl.schema : decl.path.getAsString(); throw JPQLException.multipleVariableDeclaration( getQueryInfo(), line, column, variable, text); } } /**
/** * INTERNAL * Associate the given schema with the given variable. */ public void registerSchema(String variable, String schema, int line, int column) { VariableDecl decl = (VariableDecl)variableDecls.get(variable); if (decl == null) { decl = new VariableDecl(variable, schema); variableDecls.put(variable, decl); } else { String text = decl.isRangeVariable ? decl.schema : decl.path.getAsString(); throw JPQLException.multipleVariableDeclaration( getQueryInfo(), line, column, variable, text); } }
/** * INTERNAL * Associate the given path with the given variable. */ public void registerJoinVariable(String variable, Node path, int line, int column) { VariableDecl decl = (VariableDecl)variableDecls.get(variable); if (decl == null) { decl = new VariableDecl(variable, path); variableDecls.put(variable, decl); } else { String text = decl.isRangeVariable ? decl.schema : decl.path.getAsString(); throw JPQLException.multipleVariableDeclaration( getQueryInfo(), line, column, variable, text); } } /**
/** * INTERNAL * Associate the given schema with the given variable. */ public void registerSchema(String variable, String schema, int line, int column) { VariableDecl decl = (VariableDecl)variableDecls.get(variable); if (decl == null) { decl = new VariableDecl(variable, schema); variableDecls.put(variable, decl); } else { String text = decl.isRangeVariable ? decl.schema : decl.path.getAsString(); throw JPQLException.multipleVariableDeclaration( getQueryInfo(), line, column, variable, text); } }
/** * Check the specifid constructor class and return its class instance. * @exception JPQLException if the specified constructor class could not * be found. */ private Class getConstructorClass(ParseTreeContext context) { Object type = getType(); if (type == null) { throw JPQLException.constructorClassNotFound( context.getQueryInfo(), getLine(), getColumn(), className); } return (Class)type; }
/** * Check the specific constructor class and return its class instance. * @exception JPQLException if the specified constructor class could not * be found. */ private Class getConstructorClass(ParseTreeContext context) { Object type = getType(); if (type == null) { throw JPQLException.constructorClassNotFound( context.getQueryInfo(), getLine(), getColumn(), className); } return (Class)type; }
/** * Check the specific constructor class and return its class instance. * @exception JPQLException if the specified constructor class could not * be found. */ private Class getConstructorClass(ParseTreeContext context) { Object type = getType(); if (type == null) { throw JPQLException.constructorClassNotFound( context.getQueryInfo(), getLine(), getColumn(), className); } return (Class)type; }
public Object getTypeForMapKey(ParseTreeContext context){ String name = getCanonicalVariableName(); if (context.isRangeVariable(name)) { throw JPQLException.variableCannotHaveMapKey(context.getQueryInfo(), getLine(), getColumn(), name); } else { DotNode path = (DotNode)context.pathForVariable(name); if (path == null) { throw JPQLException.aliasResolutionException( context.getQueryInfo(), getLine(), getColumn(), name); } else { return path.getTypeForMapKey(context); } } }
public Object getTypeForMapKey(ParseTreeContext context){ String name = getCanonicalVariableName(); if (context.isRangeVariable(name)) { throw JPQLException.variableCannotHaveMapKey(context.getQueryInfo(), getLine(), getColumn(), name); } else { DotNode path = (DotNode)context.pathForVariable(name); if (path == null) { throw JPQLException.aliasResolutionException( context.getQueryInfo(), getLine(), getColumn(), name); } else { return path.getTypeForMapKey(context); } } }
public Object getTypeForMapKey(ParseTreeContext context){ String name = getCanonicalVariableName(); if (context.isRangeVariable(name)) { throw JPQLException.variableCannotHaveMapKey(context.getQueryInfo(), getLine(), getColumn(), name); } else { DotNode path = (DotNode)context.pathForVariable(name); if (path == null) { throw JPQLException.aliasResolutionException( context.getQueryInfo(), getLine(), getColumn(), name); } else { return path.getTypeForMapKey(context); } } }
/** * 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 node and calculate its type. */ public void validate(ParseTreeContext context) { super.validate(context); TypeHelper typeHelper = context.getTypeHelper(); Object type = typeHelper.resolveSchema(abstractSchemaName); if (type == null) { throw JPQLException.entityTypeNotFound2( context.getQueryInfo(), getLine(), getColumn(), abstractSchemaName); } setType(type); } }
public void validate(ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); left.validate(context); if (!left.isVariableNode()){ throw JPQLException.indexOnlyAllowedOnVariable(context.getQueryInfo(), getLine(), getColumn(), left.getAsString()); } setType(typeHelper.getIntType()); } }
public void validate(ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); left.validate(context); if (!left.isVariableNode()){ throw JPQLException.indexOnlyAllowedOnVariable(context.getQueryInfo(), getLine(), getColumn(), left.getAsString()); } setType(typeHelper.getIntType()); }
public void validate(ParseTreeContext context) { TypeHelper typeHelper = context.getTypeHelper(); left.validate(context); if (!left.isVariableNode()){ throw JPQLException.indexOnlyAllowedOnVariable(context.getQueryInfo(), getLine(), getColumn(), left.getAsString()); } setType(typeHelper.getIntType()); }
/** * INTERNAL * Generate the EclipseLink expression for this node */ public Expression generateExpression(GenerationContext context) { DotNode dotNode = (DotNode)getLeft(); Node prefix = dotNode.getLeft(); String variableName = ((AttributeNode)dotNode.getRight()).getAttributeName(); // check whether variable denotes a collection valued field if (!dotNode.endsWithCollectionField(context)) { throw JPQLException.invalidSizeArgument( context.getParseTreeContext().getQueryInfo(), getLine(), getColumn(), variableName); } Expression whereClause = prefix.generateExpression(context); whereClause = whereClause.size(variableName); return whereClause; }
/** */ private void validateNavigation(Node qualifier, ParseTreeContext context) { if (qualifier.isDotNode()) { TypeHelper typeHelper = context.getTypeHelper(); Node left = qualifier.getLeft(); AttributeNode attributeNode = (AttributeNode)qualifier.getRight(); String attribute = attributeNode.getAttributeName(); Object type = left.getType(); if (!typeHelper.isEmbeddedAttribute(type, attribute)) { throw JPQLException.invalidSetClauseNavigation( context.getQueryInfo(), attributeNode.getLine(), attributeNode.getColumn(), qualifier.getAsString(), attribute); } validateNavigation(left, context); } }
/** */ private void validateTarget(Node node, ParseTreeContext context) { if (node.isDotNode()) { TypeHelper typeHelper = context.getTypeHelper(); Node path = node.getLeft(); Object type = path.getType(); AttributeNode attributeNode = (AttributeNode)node.getRight(); String attribute = attributeNode.getAttributeName(); if (typeHelper.isSingleValuedRelationship(type, attribute) || typeHelper.isSimpleStateAttribute(type, attribute)) { validateNavigation(path, context); } else { throw JPQLException.invalidSetClauseTarget( context.getQueryInfo(), attributeNode.getLine(), attributeNode.getColumn(), path.getAsString(), attribute); } } }
/** */ private void validateTarget(Node node, ParseTreeContext context) { if (node.isDotNode()) { TypeHelper typeHelper = context.getTypeHelper(); Node path = node.getLeft(); Object type = path.getType(); AttributeNode attributeNode = (AttributeNode)node.getRight(); String attribute = attributeNode.getAttributeName(); if (typeHelper.isSingleValuedRelationship(type, attribute) || typeHelper.isSimpleStateAttribute(type, attribute)) { validateNavigation(path, context); } else { throw JPQLException.invalidSetClauseTarget( context.getQueryInfo(), attributeNode.getLine(), attributeNode.getColumn(), path.getAsString(), attribute); } } }