Package org.eclipse.persistence.jpa.jpql.parser

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


        addEntities();
      }
      // After "<range variable declaration> "
      else if (expression.hasRangeVariableDeclaration()) {

        RangeVariableDeclaration rangeVariableDeclaration = findRangeVariableDeclaration(expression);

        if ((rangeVariableDeclaration != null) &&
             rangeVariableDeclaration.hasRootObject() &&
             rangeVariableDeclaration.hasSpaceAfterRootObject()) {

          length += length(rangeVariableDeclaration.getRootObject()) + SPACE_LENGTH;

          // Example: "UPDATE System s"
          if (!expression.hasSet()        &&
              !rangeVariableDeclaration.hasAs() &&
              isPositionWithin(position, length, SET)) {

            addIdentifier(SET);
          }
          // Example: "UPDATE System s "
          // Example: "UPDATE System AS s "
          else {

            if (rangeVariableDeclaration.hasAs()) {
              length += 2;
            }

            if (rangeVariableDeclaration.hasSpaceAfterAs()) {
              length++;
            }

            if (rangeVariableDeclaration.hasIdentificationVariable()) {
              length += length(rangeVariableDeclaration.getIdentificationVariable());
            }

            if (expression.hasSpaceAfterRangeVariableDeclaration()) {
              length++;
            }

            // Within "SET"
            if ((rangeVariableDeclaration.hasAs() && rangeVariableDeclaration.hasIdentificationVariable() ||
                !rangeVariableDeclaration.hasAs() && rangeVariableDeclaration.hasIdentificationVariable()) &&
                isPositionWithin(position, length, SET)) {

              addIdentifier(SET);
            }
            // After "SET "
View Full Code Here


    if (stateObject.isDecorated()) {
      toText(stateObject);
    }
    else {
      RangeVariableDeclaration expression = stateObject.getExpression();

      // "Root" object (abstract schema name or derived declaration)
      stateObject.getRootStateObject().accept(this);

      if (exactMatch && (expression != null) && expression.hasSpaceAfterRootObject()) {
        writer.append(SPACE);
      }

      // 'AS'
      if (stateObject.hasAs()) {

        if (!exactMatch || (expression == null)) {
          writer.append(SPACE);
        }

        appendIdentifier((expression != null) ? expression.getActualAsIdentifier() : AS, AS);
      }

      if (exactMatch && (expression != null) && expression.hasSpaceAfterAs()) {
        writer.append(SPACE);
      }

      // Identification variable
      if (stateObject.hasIdentificationVariable() &&
View Full Code Here

        addEntities();
      }
      // After "<range variable declaration> "
      else if (expression.hasRangeVariableDeclaration()) {

        RangeVariableDeclaration rangeVariableDeclaration = findRangeVariableDeclaration(expression);

        if ((rangeVariableDeclaration != null) &&
             rangeVariableDeclaration.hasRootObject() &&
             rangeVariableDeclaration.hasSpaceAfterRootObject()) {

          length += rangeVariableDeclaration.getRootObject().getLength() + SPACE_LENGTH;

          // Example: "UPDATE System s"
          if (!expression.hasSet()        &&
              !rangeVariableDeclaration.hasAs() &&
              isPositionWithin(position, length, SET)) {

            addIdentifier(SET);
          }
          // Example: "UPDATE System s "
          // Example: "UPDATE System AS s "
          else {

            if (rangeVariableDeclaration.hasAs()) {
              length += 2;
            }

            if (rangeVariableDeclaration.hasSpaceAfterAs()) {
              length++;
            }

            if (rangeVariableDeclaration.hasIdentificationVariable()) {
              length += rangeVariableDeclaration.getIdentificationVariable().getLength();
            }

            if (expression.hasSpaceAfterRangeVariableDeclaration()) {
              length++;
            }

            // Within "SET"
            if ((rangeVariableDeclaration.hasAs() && rangeVariableDeclaration.hasIdentificationVariable() ||
                !rangeVariableDeclaration.hasAs() && rangeVariableDeclaration.hasIdentificationVariable()) &&
                isPositionWithin(position, length, SET)) {

              addIdentifier(SET);
            }
            // After "SET "
View Full Code Here

    if (stateObject.isDecorated()) {
      toText(stateObject);
    }
    else {
      RangeVariableDeclaration expression = stateObject.getExpression();

      // "Root" object (abstract schema name or derived declaration)
      stateObject.getRootStateObject().accept(this);

      if (exactMatch && (expression != null) && expression.hasSpaceAfterRootObject()) {
        writer.append(SPACE);
      }

      // 'AS'
      if (stateObject.hasAs()) {

        if (!exactMatch || (expression == null)) {
          writer.append(SPACE);
        }

        appendIdentifier((expression != null) ? expression.getActualAsIdentifier() : AS, AS);
      }

      if (exactMatch && (expression != null) && expression.hasSpaceAfterAs()) {
        writer.append(SPACE);
      }

      // Identification variable
      if (stateObject.hasIdentificationVariable() &&
View Full Code Here

  /**
   * {@inheritDoc}
   */
  @Override
  Expression buildQueryExpression() {
    RangeVariableDeclaration declaration = (RangeVariableDeclaration) getBaseExpression();
    Expression expressoin = queryContext.buildExpression(declaration.getRootObject());
    return queryContext.getBaseExpression().getAlias(expressoin);
  }
View Full Code Here

    // called by HermesParser.buildSelectionCriteria()
    populated = true;
    resultVariables = Collections.emptySet();

    // Create the "virtual" range variable declaration
    RangeVariableDeclaration rangeVariableDeclaration = new RangeVariableDeclaration(
      entityName,
      variableName
    );

    // Make sure the identification variable was not declared more than once,
    // this could cause issues when trying to resolve it
    RangeDeclaration declaration = new RangeDeclaration(queryContext);
    declaration.rootPath               = entityName;
    declaration.baseExpression         = rangeVariableDeclaration;
    declaration.identificationVariable = (IdentificationVariable) rangeVariableDeclaration.getIdentificationVariable();

    declarations.add(declaration);

    // Make sure it is marked as the base declaration and the base Expression is created
    if (baseDeclaration == null) {
View Full Code Here

        addEntities();
      }
      // After "<range variable declaration> "
      else if (expression.hasRangeVariableDeclaration()) {

        RangeVariableDeclaration rangeVariableDeclaration = findRangeVariableDeclaration(expression);

        if ((rangeVariableDeclaration != null) &&
             rangeVariableDeclaration.hasRootObject() &&
             rangeVariableDeclaration.hasSpaceAfterRootObject()) {

          length += length(rangeVariableDeclaration.getRootObject()) + SPACE_LENGTH;

          // Example: "UPDATE System s"
          if (!expression.hasSet()        &&
              !rangeVariableDeclaration.hasAs() &&
              isPositionWithin(position, length, SET)) {

            addIdentifier(SET);
          }
          // Example: "UPDATE System s "
          // Example: "UPDATE System AS s "
          else {

            if (rangeVariableDeclaration.hasAs()) {
              length += 2;
            }

            if (rangeVariableDeclaration.hasSpaceAfterAs()) {
              length++;
            }

            if (rangeVariableDeclaration.hasIdentificationVariable()) {
              length += length(rangeVariableDeclaration.getIdentificationVariable());
            }

            if (expression.hasSpaceAfterRangeVariableDeclaration()) {
              length++;
            }

            // Within "SET"
            if ((rangeVariableDeclaration.hasAs() && rangeVariableDeclaration.hasIdentificationVariable() ||
                !rangeVariableDeclaration.hasAs() && rangeVariableDeclaration.hasIdentificationVariable()) &&
                isPositionWithin(position, length, SET)) {

              addIdentifier(SET);
            }
            // After "SET "
View Full Code Here

    if (stateObject.isDecorated()) {
      toText(stateObject);
    }
    else {
      RangeVariableDeclaration expression = stateObject.getExpression();

      // "Root" object (abstract schema name or derived declaration)
      stateObject.getRootStateObject().accept(this);

      if (exactMatch && (expression != null) && expression.hasSpaceAfterRootObject()) {
        writer.append(SPACE);
      }

      // 'AS'
      if (stateObject.hasAs()) {

        if (!exactMatch || (expression == null)) {
          writer.append(SPACE);
        }

        appendIdentifier((expression != null) ? expression.getActualAsIdentifier() : AS, AS);
      }

      if (exactMatch && (expression != null) && expression.hasSpaceAfterAs()) {
        writer.append(SPACE);
      }

      // Identification variable
      if (stateObject.hasIdentificationVariable() &&
View Full Code Here

        addEntities();
      }
      // After "<range variable declaration> "
      else if (expression.hasRangeVariableDeclaration()) {

        RangeVariableDeclaration rangeVariableDeclaration = findRangeVariableDeclaration(expression);

        if ((rangeVariableDeclaration != null) &&
             rangeVariableDeclaration.hasRootObject() &&
             rangeVariableDeclaration.hasSpaceAfterRootObject()) {

          length += rangeVariableDeclaration.getRootObject().getLength() + SPACE_LENGTH;

          // Example: "UPDATE System s"
          if (!expression.hasSet()        &&
              !rangeVariableDeclaration.hasAs() &&
              isPositionWithin(position, length, SET)) {

            addIdentifier(SET);
          }
          // Example: "UPDATE System s "
          // Example: "UPDATE System AS s "
          else {

            if (rangeVariableDeclaration.hasAs()) {
              length += 2;
            }

            if (rangeVariableDeclaration.hasSpaceAfterAs()) {
              length++;
            }

            if (rangeVariableDeclaration.hasIdentificationVariable()) {
              length += rangeVariableDeclaration.getIdentificationVariable().getLength();
            }

            if (expression.hasSpaceAfterRangeVariableDeclaration()) {
              length++;
            }

            // Within "SET"
            if ((rangeVariableDeclaration.hasAs() && rangeVariableDeclaration.hasIdentificationVariable() ||
                !rangeVariableDeclaration.hasAs() && rangeVariableDeclaration.hasIdentificationVariable()) &&
                isPositionWithin(position, length, SET)) {

              addIdentifier(SET);
            }
            // After "SET "
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jpa.jpql.parser.RangeVariableDeclaration

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.