Package org.apache.openjpa.kernel.exps

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


                if (action.op == Action.GET_XPATH)
                    break;
            }
            prevaction = action;
            if (prevaction != null && prevaction.context != null) {
                Context jCtx = JDBCStoreQuery.getThreadLocalContext(prevaction.context);
                pstate.joins = pstate.joins.setJoinContext(jCtx);
            }
        }
        if (_varName != null)
            pstate.joins = pstate.joins.setVariable(_varName);
View Full Code Here


   
    private String findSubqAlias(Select sel) {
        Select pSel = sel.getParent();
        if (pSel == null)
            return null;
        Context pCtx = pSel.ctx();
        if (pCtx.subquery == null)
            return null;
        if (pCtx.getSchema(_schemaAlias) != null)
            return ((SubQ)pCtx.subquery).getCandidateAlias();
        return findSubqAlias(pSel);
    }
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

        if (lctx.cloneFrom == cloneFrom)
            return lctx;
        java.util.List<Context> subselCtxs = lctx.getSubselContexts();
        if (subselCtxs != null) {
            for (Context subselCtx : subselCtxs) {
                Context ctx = getThreadLocalContext(subselCtx, cloneFrom);
                if (ctx != null)
                    return ctx;
            }
        }
        return null;
View Full Code Here

        }
        return newCtx;
    }

    private static Context clone(Context orig, Context parent) {
        Context myParent = null;
        if (parent == null) {
            Context origParent = orig.getParent();
            if (origParent != null)
                myParent = clone(orig.getParent(), null);
        } else
            myParent = parent;

        Context newCtx = new Context(orig.parsed, null, myParent);
        newCtx.from = orig.from;
        newCtx.meta = orig.meta;
        newCtx.schemaAlias = orig.schemaAlias;
        newCtx.setSchemas(orig.getSchemas());
        newCtx.setVariables(orig.getVariables());
        newCtx.cloneFrom = orig;
        Object select = orig.getSelect();
        if (select != null)
            newCtx.setSelect(((SelectImpl)select).clone(newCtx));
        newCtx.subquery = orig.subquery;
        List<Context> subsels = orig.getSubselContexts();
        if (subsels != null) {
            for (Context subsel : subsels)
                newCtx.addSubselContext(clone(subsel, newCtx));
        }

        return newCtx;       
    }
View Full Code Here

                if (action.op == Action.GET_XPATH)
                    break;
            }
            prevaction = action;
            if (prevaction != null && prevaction.context != null) {
                Context jCtx = JDBCStoreQuery.getThreadLocalContext(prevaction.context);
                pstate.joins = pstate.joins.setJoinContext(jCtx);
            }
        }
        if (_varName != null)
            pstate.joins = pstate.joins.setVariable(_varName);
View Full Code Here

   
    private String findSubqAlias(Select sel) {
        Select pSel = sel.getParent();
        if (pSel == null)
            return null;
        Context pCtx = pSel.ctx();
        if (pCtx.subquery == null)
            return null;
        if (pCtx.getSchema(_schemaAlias) != null)
            return ((SubQ)pCtx.subquery).getCandidateAlias();
        return findSubqAlias(pSel);
    }
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

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.