Package org.datanucleus.query.symbol

Examples of org.datanucleus.query.symbol.PropertySymbol


            symbol = symtbl.getSymbol(getId());
        }
        else
        {
            // No symbol for this variable yet, so add one - type not known
            symbol = new PropertySymbol(getId());
            symtbl.addSymbol(symbol);
        }
        return symbol;
    }
View Full Code Here


            symbol = symtbl.getSymbol(getId());
        }
        else
        {
            // No symbol for this parameter yet, so add one - type not known
            symbol = new PropertySymbol(getId());
            symtbl.addSymbol(symbol);
        }
        return symbol;
    }
View Full Code Here

            try
            {
                // Try to find this as a complete class name (e.g as used in "instanceof")
                String className = getId();
                Class cls = symtbl.getSymbolResolver().resolveClass(className);
                symbol = new PropertySymbol(getId(), cls);
            }
            catch (ClassNotResolvedException cnre)
            {
                throw new NucleusUserException("CreatorExpression defined with class of " + getId() + " yet this class is not found");
            }
View Full Code Here

            }

            try
            {
                Class symbolType = symtbl.getType(tuples);
                symbol = new PropertySymbol(getId(), symbolType);
            }
            catch (NucleusUserException nue)
            {
                // Thrown if a field in the primary expression doesn't exist.
                // This may be due to an entry like "org.jpox.samples.MyClass" used for "instanceof"
View Full Code Here

            }

            if (classAlias != null && symtbl.getSymbol(classAlias) == null)
            {
                // Add symbol for this candidate under its alias
                symtbl.addSymbol(new PropertySymbol(classAlias, cls));
            }

            if (i == 0)
            {
                // First expression so set up candidateClass/alias
                candidateClass = cls;
                candidateAlias = classAlias;
            }

            Iterator childIter = node[i].getChildNodes().iterator();
            while (childIter.hasNext())
            {
                // Add entries in symbol table for any joined aliases
                Node childNode = (Node)childIter.next();
                if (childNode.getNodeType() == Node.OPERATOR)
                {
                    Node joinedNode = childNode.getFirstChild();
                    Symbol joinedSym = symtbl.getSymbol((String)joinedNode.getNodeValue());
                    if (joinedSym == null)
                    {
                        throw new QueryCompilerSyntaxException("FROM clause has identifier " + joinedNode.getNodeValue() + " but this is unknown");
                    }
                    AbstractClassMetaData joinedCmd = metaDataManager.getMetaDataForClass(joinedSym.getValueType(), clr);
                    Class joinedCls = joinedSym.getValueType();
                    while (joinedNode.getFirstChild() != null)
                    {
                        joinedNode = joinedNode.getFirstChild();
                        String joinedMember = (String)joinedNode.getNodeValue();
                        AbstractMemberMetaData mmd = joinedCmd.getMetaDataForMember(joinedMember);
                        if (mmd == null)
                        {
                            throw new QueryCompilerSyntaxException("FROM clause has reference to " + joinedCmd.getFullClassName() + "." + joinedMember + " but it doesn't exist!");
                        }

                        int relationType = mmd.getRelationType(clr);
                        switch (relationType)
                        {
                            case Relation.ONE_TO_ONE_UNI:
                            case Relation.ONE_TO_ONE_BI:
                            case Relation.MANY_TO_ONE_BI:
                                joinedCls = mmd.getType();
                                joinedCmd = metaDataManager.getMetaDataForClass(joinedCls, clr);
                                break;
                            case Relation.ONE_TO_MANY_UNI:
                            case Relation.ONE_TO_MANY_BI:
                            case Relation.MANY_TO_MANY_BI:
                                if (mmd.hasCollection())
                                {
                                    // TODO Don't currently allow interface field navigation
                                    joinedCmd = mmd.getCollection().getElementClassMetaData(clr);
                                    joinedCls = clr.classForName(joinedCmd.getFullClassName());
                                }
                                else if (mmd.hasArray())
                                {
                                    // TODO Don't currently allow interface field navigation
                                    joinedCmd = mmd.getArray().getElementClassMetaData(clr);
                                    joinedCls = clr.classForName(joinedCmd.getFullClassName());
                                }
                                break;
                            default:
                                break;
                        }
                    }

                    Node aliasNode = childNode.getNextChild();
                    if (aliasNode.getNodeType() == Node.NAME)
                    {
                        symtbl.addSymbol(new PropertySymbol((String)aliasNode.getNodeValue(), joinedCls));
                    }
                }
            }

            ExpressionCompiler comp = new ExpressionCompiler();
View Full Code Here

    private void compileCandidates()
    {
        if (symtbl.getSymbol(candidateAlias) == null)
        {
            // Add candidate symbol if not already present (from "compileFrom")
            PropertySymbol symbol = new PropertySymbol(candidateAlias, candidateClass);
            symtbl.addSymbol(symbol);
        }
    }
View Full Code Here

                NucleusLogger.QUERY.warn(">> compileVariables param=" + varName + " but symbol already exists in table");
                varSym.setValueType(resolveClass(node[i][0].getNodeChildId()));
            }
            else
            {
                PropertySymbol sym = new PropertySymbol(varName, resolveClass(node[i][0].getNodeChildId()));
                sym.setType(Symbol.VARIABLE);
                symtbl.addSymbol(sym);
            }
        }
    }
View Full Code Here

            if (symtbl.getSymbol(paramName) != null)
            {
                NucleusLogger.QUERY.warn(">> compileParameters param=" + paramName + " but symbol already exists in table");
            }

            PropertySymbol sym = new PropertySymbol(paramName, resolveClass(node[i][0].getNodeChildId()));
            sym.setType(Symbol.PARAMETER);
            symtbl.addSymbol(sym);
        }
    }
View Full Code Here

            // Load subqueries into symbol table so the compilation knows about them
            Iterator<String> subqueryIter = subqueryMap.keySet().iterator();
            while (subqueryIter.hasNext())
            {
                String subqueryName = subqueryIter.next();
                Symbol sym = new PropertySymbol(subqueryName);
                sym.setType(Symbol.VARIABLE);
                symtbl.addSymbol(sym);
            }
        }

        Expression[] exprFrom = compileFrom();
View Full Code Here

            // Load subqueries into symbol table so the compilation knows about them
            Iterator<String> subqueryIter = subqueryMap.keySet().iterator();
            while (subqueryIter.hasNext())
            {
                String subqueryName = subqueryIter.next();
                Symbol sym = new PropertySymbol(subqueryName);
                sym.setType(Symbol.VARIABLE);
                symtbl.addSymbol(sym);
            }
        }

        compileCandidatesParametersVariables(parameters);
View Full Code Here

TOP

Related Classes of org.datanucleus.query.symbol.PropertySymbol

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.