Package org.apache.openjpa.kernel.exps

Examples of org.apache.openjpa.kernel.exps.Context


        return ctx().parsed.root;
    }

    private ClassMetaData getMetaDataForAlias(String alias) {
        for (int i = contexts.size() - 1; i >= 0; i--) {
            Context context =  contexts.get(i);
            if (alias.equalsIgnoreCase(context.schemaAlias))
                return context.meta;
        }

        return null;
View Full Code Here


    protected void addVariableToContext(String id, Value var) {
        ctx().addVariable(id, var);
    }

    protected Value getVariable(String var) {
        Context c = ctx();
        Value v = c.getVariable(var);
        if (v != null)
            return v;
        if (c.getParent() != null)
            return c.getParent().findVariable(var);

        return null;
    }
View Full Code Here

            // don't let the get alias methods see that a var has been set
            // until we get past the local table
            String var = this.var;
            this.var = null;
            Context ctx = context;
            context = null;

            int alias1 = _sel.getTableIndex(localTable, this, true);
            this.append(var);
            this.append(correlatedVar);
View Full Code Here

            int subs, boolean inverse, boolean toMany, boolean outer) {
            // don't let the get alias methods see that a var has been set
            // until we get past the local table
            String var = this.var;
            this.var = null;
            Context ctx = context;
            context = null;

            // get first table alias before updating path; if there is a from
            // select then we shouldn't actually create a join object, since
            // the joins will all be done in the from select
View Full Code Here

    }

    public static Context getThreadLocalContext(Context orig) {
        Context[] root = localContext.get();
        for (int i = 0; i < root.length; i++) {
            Context lctx = getThreadLocalContext(root[i], orig);
            if (lctx != null)
                return lctx;
        }
        return null;
    }
View Full Code Here

    public static Select getThreadLocalSelect(Select select) {
        if (select == null)
            return null;
        Context[] lctx = JDBCStoreQuery.getThreadLocalContext();
        Context cloneFrom = select.ctx();
        for (int i = 0; i < lctx.length; i++) {
            Context cloneTo = getThreadLocalContext(lctx[i], cloneFrom);
            if (cloneTo != null)
                return (Select)cloneTo.getSelect();
        }
        return select;
    }
View Full Code Here

        String alias = _schemaAlias;
        if (isPathInThisContext(pj) || table.isAssociation())         
            alias = null;

        // find the context where this alias is defined
        Context ctx = (alias != null) ?
            _ctx.findContext(alias) : null;
        if (ctx != null)
            sel = (SelectImpl) ctx.getSelect();

        if (!create)
            i = sel.findAlias(table, key)// find in parent and in myself
        else
            i = sel.getAlias(table, key); // find in myself
        if (i != null)
            return i;
       
        if (create) { // create here
            i = sel.createAlias(table, key);
        } else if (ctx != null && ctx != ctx()) { // create in other select
            i = ((SelectImpl)ctx.getSelect()).createAlias(table, key);
        }

        return i;
    }
View Full Code Here

        return i;
    }

    private boolean isPathInThisContext(PathJoins pj) {
        // currCtx is set from Action, it is reset to null after the PCPath initialization
        Context currCtx = pj == null ? null : ((PathJoinsImpl)pj).context;
       
        // lastCtx is set to currCtx after the SelectJoins.join. pj.lastCtx and pj.path string are
        // the last snapshot of pj. They will be used together for later table alias resolution in
        // the getColumnAlias().
        Context lastCtx = pj == null ? null : ((PathJoinsImpl)pj).lastContext;
        Context thisCtx = currCtx == null ? lastCtx : currCtx;
        String corrVar = pj == null ? null : pj.getCorrelatedVariable();
       
        return (pj != null && pj.path() != null &&
            (corrVar == null || (thisCtx != null && ctx() == thisCtx)));
    }
View Full Code Here

     */
    public JPQLExpressionBuilder(ExpressionFactory factory,
        ExpressionStoreQuery query, Object parsedQuery) {
        super(factory, query.getResolver());

        contexts.push(new Context(parsedQuery instanceof ParsedJPQL
            ? (ParsedJPQL) parsedQuery
            : parsedQuery instanceof String
            ? getParsedQuery((String) parsedQuery)
            : null, null, null));

View Full Code Here

        if (candidate == null && fmd.isElementCollection())
            candidate = fmd.getDefiningMetaData();

        setCandidate(candidate, alias);

        Context subContext = ctx();
        Subquery subquery = ctx().getSubquery();
        if (subquery == null){
            subquery = factory.newSubquery(candidate, true, alias);
            subContext.setSubquery(subquery);
        }
        else {
            subquery.setSubqAlias(alias);
        }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.kernel.exps.Context

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.