Examples of IdentificationVariable


Examples of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable

    /**
     * {@link InputParameter}
     */
    @Override
    public void visit(ValueExpression expression) {
      IdentificationVariable identificationVariable = (IdentificationVariable) expression.getExpression();
      Declaration declaration = queryContext.getDeclaration(identificationVariable.getVariableName());
      descriptor = declaration.getDescriptor();
    }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable

  /**
   * {@inheritDoc}
   */
  public void visit(RangeVariableDeclaration expression) {

    IdentificationVariable variable = (IdentificationVariable) expression.getIdentificationVariable();
    Declaration declaration = queryContext.getDeclaration(variable.getVariableName());

    // If the Declaration is RangeDeclaration, then retrieve its Descriptor directly,
    // this will support two cases automatically, the "root" object is
    // 1) An abstract schema name (entity name) -> parsed as AbstractSchemaName
    // 2) A fully qualified class name -> parsed as a CollectionValuedPathExpression
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable

   * {@inheritDoc}
   */
  public void visit(ResultVariable expression) {

    expression.getSelectExpression().accept(this);
    IdentificationVariable identificationVariable = (IdentificationVariable) expression.getResultVariable();
    String variableName = identificationVariable.getVariableName();
    queryContext.addQueryExpression(variableName, queryExpression);

    // Note: The type will be calculated when traversing the select expression
  }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable

      // If a subquery is defined in a WHERE clause of an update query,
      // then check for a path expression
      if (isWithinSubquery(expression)) {

        // Find the identification variable from the UPDATE range declaration
        IdentificationVariable identificationVariable = findVirtualIdentificationVariable(expression);
        String variableName = (identificationVariable != null) ? identificationVariable.getText() : null;

        if (ExpressionTools.stringIsNotEmpty(variableName)) {

          Object mapping = helper.resolveMapping(variableName, abstractSchemaName);
          Object type = helper.getMappingType(mapping);
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable

        // The left expression cannot be an identification variable
        if (validator.leftIdentificationVariable &&
            validator.leftIdentificationVariableValid) {

          IdentificationVariable variable = (IdentificationVariable) leftExpression;

          // There is a specific EclipseLink case where it is valid to use an
          // identification variable, which is when the identification variable
          // maps to a direct collection mapping
          if (!isIdentificationVariableValidInComparison(variable)) {

            addProblem(
              leftExpression,
              ComparisonExpression_IdentificationVariable,
              leftExpression.toActualText(),
              expression.getComparisonOperator()
            );

            valid = false;
          }
        }
        // The left expression is a path expression
        else if (validator.leftStateFieldPathExpression &&
                 validator.leftStateFieldPathExpressionValid) {

          Object mapping = helper.resolveMapping(leftExpression);

          // The path expression cannot be a non-basic mapping
          if ((mapping != null) && !helper.isPropertyMapping(mapping)) {

            addProblem(
              leftExpression,
              ComparisonExpression_AssociationField,
              leftExpression.toActualText(),
              expression.getComparisonOperator()
            );

            valid = false;
          }
        }

        // The right expression cannot be an identification variable
        if (validator.rightIdentificationVariable &&
            validator.rightIdentificationVariableValid) {

          IdentificationVariable variable = (IdentificationVariable) rightExpression;

          // There is a specific EclipseLink case where it is valid to use an
          // identification variable, which is when the identification variable
          // maps to a direct collection mapping
          if (!isIdentificationVariableValidInComparison(variable)) {

            addProblem(
              rightExpression,
              ComparisonExpression_IdentificationVariable,
              rightExpression.toActualText(),
              expression.getComparisonOperator()
            );

            valid = false;
          }
        }
        // The right expression is a path expression
        else if (validator.rightStateFieldPathExpression      &&
                 validator.rightStateFieldPathExpressionValid) {

          Object mapping = helper.resolveMapping(rightExpression);

          // The path expression cannot be a non-basic mapping
          if ((mapping != null) && !helper.isPropertyMapping(mapping)) {

            addProblem(
              rightExpression,
              ComparisonExpression_AssociationField,
              rightExpression.toActualText(),
              expression.getComparisonOperator()
            );

            valid = false;
          }
        }
      }
      // '=', '<>'
      else {

        // The left expression is an identification variable
        // The right expression is a path expression
        if (validator.leftIdentificationVariable      &&
            validator.leftIdentificationVariableValid &&
            validator.rightStateFieldPathExpression   &&
            validator.rightStateFieldPathExpressionValid) {

          Object mapping = helper.resolveMapping(rightExpression);
          IdentificationVariable variable = (IdentificationVariable) leftExpression;

          // The path expression can only be a non-basic mapping.
          // There is a specific EclipseLink case where it is valid to use an
          // identification variable, which is when the identification variable
          // maps to a direct collection mapping
          if ((mapping != null) && helper.isPropertyMapping(mapping) &&
              !isIdentificationVariableValidInComparison(variable)) {

            addProblem(
              rightExpression,
              ComparisonExpression_BasicField,
              rightExpression.toActualText(),
              expression.getComparisonOperator()
            );

            valid = false;
          }
        }
        // The left expression is a path expression
        // The right expression is an identification variable
        else if (validator.rightIdentificationVariable      &&
                 validator.rightIdentificationVariableValid &&
                 validator.leftStateFieldPathExpression     &&
                 validator.leftStateFieldPathExpressionValid) {

          Object mapping = helper.resolveMapping(leftExpression);
          IdentificationVariable variable = (IdentificationVariable) rightExpression;

          // The path expression can only be a non-basic mapping.
          // There is a specific EclipseLink case where it is valid to use an
          // identification variable, which is when the identification variable
          // maps to a direct collection mapping
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable

  /**
   * {@inheritDoc}
   */
  public void visit(KeyExpression expression) {
    IdentificationVariable identificationVariable = (IdentificationVariable) expression.getExpression();
    Declaration declaration = queryContext.findDeclaration(identificationVariable.getVariableName());
    DatabaseMapping mapping = declaration.getMapping();
    MappedKeyMapContainerPolicy mapContainerPolicy = (MappedKeyMapContainerPolicy) mapping.getContainerPolicy();
    type = (Class<?>) mapContainerPolicy.getKeyType();
  }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable

  /**
   * {@inheritDoc}
   */
  public void visit(ValueExpression expression) {

    IdentificationVariable identificationVariable = (IdentificationVariable) expression.getExpression();
    Declaration declaration = queryContext.findDeclaration(identificationVariable.getVariableName());
    DatabaseMapping mapping = declaration.getMapping();

    if (mapping.isDirectMapMapping()) {
      DirectMapMapping mapMapping = (DirectMapMapping) mapping;
      type = mapMapping.getValueClass();
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable

     * {@inheritDoc}
     */
    @Override
    public void visit(EntryExpression expression) {

      IdentificationVariable identificationVariable = (IdentificationVariable) expression.getExpression();
      String variableName = identificationVariable.getVariableName();

      // Retrieve the Expression for the identification variable
      declaration = queryContext.findDeclaration(variableName);
      declaration.getBaseExpression().accept(ExpressionBuilderVisitor.this);
      localExpression = queryExpression;
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable

     * {@inheritDoc}
     */
    @Override
    public void visit(KeyExpression expression) {

      IdentificationVariable identificationVariable = (IdentificationVariable) expression.getExpression();

      // Create the Expression for the identification variable
      identificationVariable.accept(ExpressionBuilderVisitor.this);
      localExpression = new MapEntryExpression(queryExpression);

      // Retrieve the mapping's key mapping's descriptor
      descriptor = queryContext.resolveDescriptor(expression);
    }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable

     * {@inheritDoc}
     */
    @Override
    public void visit(ValueExpression expression) {

      IdentificationVariable identificationVariable = (IdentificationVariable) expression.getExpression();

      // Create the Expression for the identification variable
      identificationVariable.accept(ExpressionBuilderVisitor.this);
      localExpression = queryExpression;

      // Retrieve the mapping's reference descriptor
      declaration = queryContext.findDeclaration(identificationVariable.getVariableName());
      descriptor = declaration.getDescriptor();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.