/** * Returns the Expression {@link Expression} for this {@link Declaration}. * * @return The {@link org.eclipse.persistence.expressions.Expression Expression} representing the * information of this {@link Declaration} */ final org.eclipse.persistence.expressions.Expression getQueryExpression() { if (queryExpression == null) { // First create the Expression queryExpression = buildQueryExpression(); // Cache the base expression with its identification variable as well queryContext.addQueryExpressionImp(getVariableName(), queryExpression); } return queryExpression; }
/** * {@inheritDoc} */ @Override public RangeVariableDeclaration getBaseExpression() { return (RangeVariableDeclaration) super.getBaseExpression(); }
/** * {@inheritDoc} */ @Override public IdentificationVariableDeclaration getDeclarationExpression() { return (IdentificationVariableDeclaration) super.getDeclarationExpression(); }
Declaration declaration = queryContext.getDeclaration(variable.getVariableName()); switch (declaration.getType()) { type[0] = declaration.getDescriptor().getJavaClass(); queryExpression = new ExpressionBuilder(type[0]); break; queryExpression = declaration.getQueryExpression(); break;
declaration.getBaseExpression().accept(this); queryContext.addQueryExpression(variableName, queryExpression); if (declaration.getType() == Type.RANGE) { type[0] = declaration.getDescriptor().getJavaClass();
switch (declaration.getType()) { if (declaration.getVariableName().equalsIgnoreCase(variableName)) { return true; return joinDeclaration.getMapping().isCollectionMapping();
private void collectDescriptors(Expression expression, DeclarationResolver resolver) { resolver.populate(expression); for (Declaration declaration : resolver.getDeclarations()) { ClassDescriptor descriptor = declaration.getDescriptor(); if (descriptor != null) { descriptors.add(descriptor); } } }
/** * {@inheritDoc} */ @Override public boolean isIdentificationVariableValidInComparison(IdentificationVariable expression) { Declaration declaration = queryContext.findDeclaration(expression.getVariableName()); if (declaration == null) { return false; } DatabaseMapping mapping = declaration.getMapping(); if (mapping == null) { return false; } // Direct collection is not an object so it's valid return mapping.isDirectCollectionMapping() || mapping.isAbstractCompositeDirectCollectionMapping(); }
/** * Retrieves the {@link Declaration} for which the given variable name is used to navigate to the * "root" object. * * @param variableName The name of the identification variable that is used to navigate a "root" * object * @return The {@link Declaration} containing the information about the identification variable * declaration */ Declaration getDeclaration(String variableName) { for (Declaration declaration : declarations) { if (declaration.getVariableName().equalsIgnoreCase(variableName)) { return declaration; } } return null; }
private boolean isRangeIdentificationVariableImp(String variableName) { Declaration declaration = getDeclaration(variableName); return (declaration != null) && declaration.getType().isRange(); }
/** * Returns the {@link ClassDescriptor} that represents this {@link Declaration}'s "root" path. * * @return The descriptor of the "root" path */ final ClassDescriptor getDescriptor() { if (descriptor == null) { descriptor = resolveDescriptor(); } return descriptor; }
/** * Returns the root {@link Expression} for which all new {@link Expression expressions} a child. * * @return The root {@link Expression} of the query or subquery */ Expression getBaseExpression() { // Retrieve the first declaration, which is the base declaration (For top-level query, it's // always a range over an abstract schema name. For subqueries, it's either a range over an // abstract schema name or a derived path expression) return getDeclarationResolver().getFirstDeclaration().getQueryExpression(); }
/** * Returns the {@link DatabaseMapping} that this {@link Declaration} represents, which may be * <code>null</code> in the case it does not represent one. * * @return Either the {@link DatabaseMapping} of the "root" path, or <code>null</code> if the * "root" path is not a mapping */ final DatabaseMapping getMapping() { if (mapping == null) { mapping = resolveMapping(); } return mapping; }
Declaration declaration = queryContext.getDeclaration(variable.getVariableName()); switch (declaration.getType()) { type[0] = declaration.getDescriptor().getJavaClass(); queryExpression = new ExpressionBuilder(type[0]); break; queryExpression = declaration.getQueryExpression(); break;
declaration.getBaseExpression().accept(this); queryContext.addQueryExpression(variableName, queryExpression); if (declaration.getType() == Type.RANGE) { type[0] = declaration.getDescriptor().getJavaClass();
switch (declaration.getType()) { if (declaration.getVariableName().equalsIgnoreCase(variableName)) { return true; return joinDeclaration.getMapping().isCollectionMapping();
private void collectDescriptors(Expression expression, DeclarationResolver resolver) { resolver.populate(expression); for (Declaration declaration : resolver.getDeclarations()) { ClassDescriptor descriptor = declaration.getDescriptor(); if (descriptor != null) { descriptors.add(descriptor); } } }
/** * {@inheritDoc} */ @Override public boolean isIdentificationVariableValidInComparison(IdentificationVariable expression) { Declaration declaration = queryContext.findDeclaration(expression.getVariableName()); if (declaration == null) { return false; } DatabaseMapping mapping = declaration.getMapping(); if (mapping == null) { return false; } // Direct collection is not an object so it's valid return mapping.isDirectCollectionMapping() || mapping.isAbstractCompositeDirectCollectionMapping(); }
/** * Retrieves the {@link Declaration} for which the given variable name is used to navigate to the * "root" object. * * @param variableName The name of the identification variable that is used to navigate a "root" * object * @return The {@link Declaration} containing the information about the identification variable * declaration */ Declaration getDeclaration(String variableName) { for (Declaration declaration : declarations) { if (declaration.getVariableName().equalsIgnoreCase(variableName)) { return declaration; } } return null; }
private boolean isRangeIdentificationVariableImp(String variableName) { Declaration declaration = getDeclaration(variableName); return (declaration != null) && declaration.getType().isRange(); }