private Path newPath(Value val, ClassMetaData meta) { Path path = val == null ? factory.newPath() : factory.newPath(val); if (meta != null) path.setMetaData(meta); return path; }
private Path newPath(Value val, ClassMetaData meta) { Path path = val == null ? factory.newPath() : factory.newPath(val); if (meta != null) path.setMetaData(meta); return path; }
private Path newPath(Value val, ClassMetaData meta) { Path path = val == null ? factory.newPath() : factory.newPath(val); if (meta != null) path.setMetaData(meta); return path; }
private Path newPath(Value val, ClassMetaData meta) { Path path = val == null ? factory.newPath() : factory.newPath(val); if (meta != null) path.setMetaData(meta); return path; }
private Path newPath(Value val, ClassMetaData meta) { Path path = val == null ? factory.newPath() : factory.newPath(val); if (meta != null) path.setMetaData(meta); return path; }
@Override public Value toValue(ExpressionFactory factory, CriteriaQueryImpl<?> c) { ClassMetaData meta = _member.fmd.getDeclaredTypeMetaData(); org.apache.openjpa.kernel.exps.Path path = null; SubqueryImpl<?> subquery = c.getDelegator(); PathImpl<?,?> parent = getInnermostParentPath(); Value val = c.getRegisteredValue(this); if (val != null) return val; else if (parent.inSubquery(subquery)) { org.apache.openjpa.kernel.exps.Subquery subQ = subquery.getSubQ(); path = factory.newPath(subQ); path.setMetaData(subQ.getMetaData()); path.setSchemaAlias(c.getAlias(this)); path.get(_member.fmd, allowNull); } else { path = (org.apache.openjpa.kernel.exps.Path) _parent.toValue(factory, c); path.get(_member.fmd, allowNull); path.setMetaData(meta); path.setImplicitType(meta.getDescribedType()); } return path; }
/** * Convert this path to a kernel path value. */ @Override public Value toValue(ExpressionFactory factory, CriteriaQueryImpl<?> c) { SubqueryImpl<?> subquery = c.getDelegator(); Path var = null; Value val = null; String alias = c.getAlias(this); if (c.ctx() != null && !alias.equalsIgnoreCase(c.ctx().schemaAlias) && (val = c.getRegisteredRootVariable(this)) != null) { // this is cross join var = factory.newPath(val); } else if (inSubquery(subquery)) { Subquery subQ = subquery.getSubQ(); var = factory.newPath(subQ); } else { var = factory.newPath(); var.setSchemaAlias(alias); } var.setMetaData(_entity.meta); return var; }
/** * Convert this path to a kernel path value. */ @Override public Value toValue(ExpressionFactory factory, CriteriaQueryImpl<?> c) { SubqueryImpl<?> subquery = c.getDelegator(); Path var = null; Value val = null; String alias = c.getAlias(this); if (c.ctx() != null && !alias.equalsIgnoreCase(c.ctx().schemaAlias) && (val = c.getRegisteredRootVariable(this)) != null) { // this is cross join var = factory.newPath(val); } else if (inSubquery(subquery)) { Subquery subQ = subquery.getSubQ(); var = factory.newPath(subQ); } else { var = factory.newPath(); var.setSchemaAlias(alias); } var.setMetaData(_entity.meta); return var; }
@Override public Value toValue(ExpressionFactory factory, CriteriaQueryImpl<?> c) { ClassMetaData meta = _member.fmd.getDeclaredTypeMetaData(); org.apache.openjpa.kernel.exps.Path path = null; SubqueryImpl<?> subquery = c.getDelegator(); PathImpl<?,?> parent = getInnermostParentPath(); Value val = c.getRegisteredValue(this); if (val != null) return val; else if (parent.inSubquery(subquery)) { org.apache.openjpa.kernel.exps.Subquery subQ = subquery.getSubQ(); path = factory.newPath(subQ); path.setMetaData(subQ.getMetaData()); path.setSchemaAlias(c.getAlias(this)); path.get(_member.fmd, allowNull); } else { path = (org.apache.openjpa.kernel.exps.Path) _parent.toValue(factory, c); path.get(_member.fmd, allowNull); path.setMetaData(meta); path.setImplicitType(meta.getDescribedType()); } return path; }
@Override public Value toValue(ExpressionFactory factory, CriteriaQueryImpl<?> c) { ClassMetaData meta = _member.fmd.getDeclaredTypeMetaData(); org.apache.openjpa.kernel.exps.Path path = null; SubqueryImpl<?> subquery = c.getDelegator(); PathImpl<?,?> parent = getInnermostParentPath(); Value val = c.getRegisteredValue(this); if (val != null) return val; else if (parent.inSubquery(subquery)) { org.apache.openjpa.kernel.exps.Subquery subQ = subquery.getSubQ(); path = factory.newPath(subQ); path.setMetaData(subQ.getMetaData()); path.setSchemaAlias(c.getAlias(this)); path.get(_member.fmd, allowNull); } else { path = (org.apache.openjpa.kernel.exps.Path) _parent.toValue(factory, c); path.get(_member.fmd, allowNull); path.setMetaData(meta); path.setImplicitType(meta.getDescribedType()); } return path; }
@Override public Value toValue(ExpressionFactory factory, CriteriaQueryImpl<?> c) { ClassMetaData meta = _member.fmd.getDeclaredTypeMetaData(); org.apache.openjpa.kernel.exps.Path path = null; SubqueryImpl<?> subquery = c.getDelegator(); PathImpl<?,?> parent = getInnermostParentPath(); Value val = c.getRegisteredValue(this); if (val != null) return val; else if (parent.inSubquery(subquery)) { org.apache.openjpa.kernel.exps.Subquery subQ = subquery.getSubQ(); path = factory.newPath(subQ); path.setMetaData(subQ.getMetaData()); path.setSchemaAlias(c.getAlias(this)); path.get(_member.fmd, allowNull); } else { path = (org.apache.openjpa.kernel.exps.Path) _parent.toValue(factory, c); path.get(_member.fmd, allowNull); path.setMetaData(meta); path.setImplicitType(meta.getDescribedType()); } return path; }
/** * Convert this path to a kernel path value. */ @Override public Value toValue(ExpressionFactory factory, CriteriaQueryImpl<?> c) { SubqueryImpl<?> subquery = c.getDelegator(); Path var = null; Value val = null; String alias = c.getAlias(this); if (c.ctx() != null && !alias.equalsIgnoreCase(c.ctx().schemaAlias) && (val = c.getRegisteredRootVariable(this)) != null) { // this is cross join var = factory.newPath(val); } else if (inSubquery(subquery)) { Subquery subQ = subquery.getSubQ(); var = factory.newPath(subQ); } else { var = factory.newPath(); var.setSchemaAlias(alias); } var.setMetaData(_entity.meta); return var; }
/** * Convert this path to a kernel path value. */ @Override public Value toValue(ExpressionFactory factory, CriteriaQueryImpl<?> c) { SubqueryImpl<?> subquery = c.getDelegator(); Path var = null; Value val = null; String alias = c.getAlias(this); if (c.ctx() != null && !alias.equalsIgnoreCase(c.ctx().schemaAlias) && (val = c.getRegisteredRootVariable(this)) != null) { // this is cross join var = factory.newPath(val); } else if (inSubquery(subquery)) { Subquery subQ = subquery.getSubQ(); var = factory.newPath(subQ); } else { var = factory.newPath(); var.setSchemaAlias(alias); } var.setMetaData(_entity.meta); return var; }
private Path getQualifiedPath(JPQLNode node, boolean pcOnly, boolean inner) { int nChild = node.getChildCount(); JPQLNode firstChild = firstChild(node); JPQLNode id = firstChild.id == JJTKEY ? onlyChild(firstChild) : firstChild; Path path = validateMapPath(firstChild, id); if (firstChild.id == JJTIDENTIFIER) return getPath(node); FieldMetaData fld = path.last(); path = (Path) factory.getKey(path); ClassMetaData meta = fld.getKey().getTypeMetaData(); if (meta == null) throw parseException(EX_USER, "bad-qualified-path", new Object[]{ id.text }, null); path.setMetaData(meta); // walk through the children and assemble the path boolean allowNull = !inner; for (int i = 1; i < nChild; i++) { path = (Path) traversePath(path, node.children[i].text, pcOnly, allowNull); // all traversals but the first one will always be inner joins allowNull = false; } return path; }
private Path getQualifiedPath(JPQLNode node, boolean pcOnly, boolean inner) { int nChild = node.getChildCount(); JPQLNode firstChild = firstChild(node); JPQLNode id = firstChild.id == JJTKEY ? onlyChild(firstChild) : firstChild; Path path = validateMapPath(firstChild, id); if (firstChild.id == JJTIDENTIFIER) return getPath(node); FieldMetaData fld = path.last(); path = (Path) factory.getKey(path); ClassMetaData meta = fld.getKey().getTypeMetaData(); if (meta == null) throw parseException(EX_USER, "bad-qualified-path", new Object[]{ id.text }, null); path.setMetaData(meta); // walk through the children and assemble the path boolean allowNull = !inner; for (int i = 1; i < nChild; i++) { path = (Path) traversePath(path, node.children[i].text, pcOnly, allowNull); // all traversals but the first one will always be inner joins allowNull = false; } return path; }
/** * Convert this path to a kernel path (value). */ @Override public Value toValue(ExpressionFactory factory, CriteriaQueryImpl<?> c) { org.apache.openjpa.kernel.exps.Path path = null; SubqueryImpl<?> subquery = c.getDelegator(); PathImpl<?,?> parent = getInnermostParentPath(); Value var = c.getRegisteredVariable(this); if (var != null) { path = factory.newPath(var); } else if (parent.inSubquery(subquery)) { org.apache.openjpa.kernel.exps.Subquery subQ = subquery.getSubQ(); path = factory.newPath(subQ); path.setMetaData(subQ.getMetaData()); path.setSchemaAlias(c.getAlias(this)); } else { path = (org.apache.openjpa.kernel.exps.Path) _parent.toValue(factory, c); path.get(_member.fmd, allowNull); } return path; }
/** * Convert this path to a kernel path (value). */ @Override public Value toValue(ExpressionFactory factory, CriteriaQueryImpl<?> c) { org.apache.openjpa.kernel.exps.Path path = null; SubqueryImpl<?> subquery = c.getDelegator(); PathImpl<?,?> parent = getInnermostParentPath(); Value var = c.getRegisteredVariable(this); if (var != null) { path = factory.newPath(var); } else if (parent.inSubquery(subquery)) { org.apache.openjpa.kernel.exps.Subquery subQ = subquery.getSubQ(); path = factory.newPath(subQ); path.setMetaData(subQ.getMetaData()); path.setSchemaAlias(c.getAlias(this)); } else { path = (org.apache.openjpa.kernel.exps.Path) _parent.toValue(factory, c); path.get(_member.fmd, allowNull); } return path; }
/** * Convert this path to a kernel path (value). */ @Override public Value toValue(ExpressionFactory factory, CriteriaQueryImpl<?> c) { org.apache.openjpa.kernel.exps.Path path = null; SubqueryImpl<?> subquery = c.getDelegator(); PathImpl<?,?> parent = getInnermostParentPath(); Value var = c.getRegisteredVariable(this); if (var != null) { path = factory.newPath(var); } else if (parent.inSubquery(subquery)) { org.apache.openjpa.kernel.exps.Subquery subQ = subquery.getSubQ(); path = factory.newPath(subQ); path.setMetaData(subQ.getMetaData()); path.setSchemaAlias(c.getAlias(this)); } else { path = (org.apache.openjpa.kernel.exps.Path) _parent.toValue(factory, c); path.get(_member.fmd, allowNull); } return path; }
/** * Convert this path to a kernel path (value). */ @Override public Value toValue(ExpressionFactory factory, CriteriaQueryImpl<?> c) { org.apache.openjpa.kernel.exps.Path path = null; SubqueryImpl<?> subquery = c.getDelegator(); PathImpl<?,?> parent = getInnermostParentPath(); Value var = c.getRegisteredVariable(this); if (var != null) { path = factory.newPath(var); } else if (parent.inSubquery(subquery)) { org.apache.openjpa.kernel.exps.Subquery subQ = subquery.getSubQ(); path = factory.newPath(subQ); path.setMetaData(subQ.getMetaData()); path.setSchemaAlias(c.getAlias(this)); } else { path = (org.apache.openjpa.kernel.exps.Path) _parent.toValue(factory, c); path.get(_member.fmd, allowNull); } return path; }
/** * Adds a join condition to the given expression. * * @param node the node to check * @param inner whether or not the join should be an inner join * @param exp an existing expression to AND, or null if none * @return the Expression with the join condition added */ private Expression addJoin(JPQLNode node, boolean inner, Expression exp) { // the type will be the declared type for the field Path path = getPath(firstChild(node), false, inner); JPQLNode alias = node.getChildCount() >= 2 ? right(node) : null; // OPENJPA-15 support subquery's from clause do not start with // identification_variable_declaration() if (inner && ctx().subquery != null && ctx().schemaAlias == null) { setCandidate(getFieldType(path.last()), alias.text); Path subpath = factory.newPath(ctx().subquery); subpath.setMetaData(ctx().subquery.getMetaData()); exp = and(exp, factory.equal(path, subpath)); } return addJoin(path, alias, exp); }