Package org.eclipse.persistence.jpa.internal.jpql.DeclarationResolver

Examples of org.eclipse.persistence.jpa.internal.jpql.DeclarationResolver.Declaration


    // or the JOIN expression before joinIndex
    boolean scanDeclaration = (joinIndex > -1);

    for (int index = 0; scanDeclaration ? (index <= variableNameIndex) : (index < variableNameIndex); index++) {

      Declaration declaration = declarations.get(index);
      String previousVariableName = declaration.getVariableName();

      if (variableName.equalsIgnoreCase(previousVariableName)) {
        return true;
      }

      if (declaration.hasJoins()) {
        List<Map.Entry<Join, String>> joinEntries = declaration.getJoinEntries();

        // Scan all the JOIN expression if index is not variableNameIndex, otherwise
        // scan up to joinIndex, exclusively
        int endIndex = (index == variableNameIndex) ? joinIndex : joinEntries.size();
View Full Code Here


      // the FROM clause, and an identification variable declaration can use the result
      // of a preceding identification variable declaration of the query string
      List<Declaration> declarations = queryContext.getDeclarations();

      for (int index = 0, count = declarations.size(); index < count; index++) {
        Declaration declaration = declarations.get(index);

        // Check the JOIN expressions in the identification variable declaration
        if (declaration.isRange() && declaration.hasJoins()) {

          List<Map.Entry<Join, String>> joinEntries = declaration.getJoinEntries();

          for (int joinIndex = 0, joinCount = joinEntries.size(); joinIndex < joinCount; joinIndex++) {
            Map.Entry<Join, String> joinEntry = joinEntries.get(joinIndex);
            Join join = joinEntry.getKey();

            // Retrieve the identification variable from the join association path
            String variableName = queryContext.literal(
              join.getJoinAssociationPath(),
              LiteralType.PATH_EXPRESSION_IDENTIFICATION_VARIABLE
            );

            // Make sure the identification variable is defined before the JOIN expression
            if (ExpressionTools.stringIsNotEmpty(variableName) &&
                !isIdentificationVariableDeclaredBefore(variableName, index, joinIndex, declarations)) {

              int startPosition = position(join.getJoinAssociationPath());
              int endPosition   = startPosition + variableName.length();

              addProblem(
                expression,
                startPosition,
                endPosition,
                AbstractFromClause_WrongOrderOfIdentificationVariableDeclaration,
                variableName
              );
            }
          }
        }
        // Check the collection member declaration
        else if (!declaration.isRange()) {

          // Retrieve the identification variable from the path expression
          String variableName = queryContext.literal(
            declaration.getBaseExpression(),
            LiteralType.PATH_EXPRESSION_IDENTIFICATION_VARIABLE
          );

          if (ExpressionTools.stringIsNotEmpty(variableName) &&
              !isIdentificationVariableDeclaredBefore(variableName, index, -1, declarations)) {

            int startPosition = position(declaration.getDeclarationExpression()) - variableName.length();
            int endPosition   = startPosition + variableName.length();

            addProblem(
              expression,
              startPosition,
View Full Code Here

  protected void convertUnqualifiedDeclaration(Declaration declaration) {

    if (parent != null) {

      // Retrieve the range identification variable from the parent declaration
      Declaration parentDeclaration = parent.getDeclarationResolverImp().getDeclarations().get(0);
      String outerVariableName = parentDeclaration.getVariableName();

      // Qualify the range expression to be fully qualified
      getDeclarationResolverImp().convertUnqualifiedDeclaration(declaration, outerVariableName);
    }
  }
View Full Code Here

  protected void convertUnqualifiedDeclaration(Declaration declaration) {

    if (parent != null) {

      // Retrieve the range identification variable from the parent declaration
      Declaration parentDeclaration = parent.getDeclarationResolverImp().getDeclarations().get(0);
      String outerVariableName = parentDeclaration.getVariableName();

      // Qualify the range expression to be fully qualified
      getDeclarationResolverImp().convertUnqualifiedDeclaration(declaration, outerVariableName);
    }
  }
View Full Code Here

    // or the JOIN expression before joinIndex
    boolean scanDeclaration = (joinIndex > -1);

    for (int index = 0; scanDeclaration ? (index <= variableNameIndex) : (index < variableNameIndex); index++) {

      Declaration declaration = declarations.get(index);
      String previousVariableName = declaration.getVariableName();

      if (variableName.equalsIgnoreCase(previousVariableName)) {
        return true;
      }

      if (declaration.hasJoins()) {
        List<Map.Entry<Join, String>> joinEntries = declaration.getJoinEntries();

        // Scan all the JOIN expression if index is not variableNameIndex, otherwise
        // scan up to joinIndex, exclusively
        int endIndex = (index == variableNameIndex) ? joinIndex : joinEntries.size();
View Full Code Here

      // the FROM clause, and an identification variable declaration can use the result
      // of a preceding identification variable declaration of the query string
      List<Declaration> declarations = queryContext.getDeclarations();

      for (int index = 0, count = declarations.size(); index < count; index++) {
        Declaration declaration = declarations.get(index);

        // Check the JOIN expressions in the identification variable declaration
        if (declaration.isRange() && declaration.hasJoins()) {

          List<Map.Entry<Join, String>> joinEntries = declaration.getJoinEntries();

          for (int joinIndex = 0, joinCount = joinEntries.size(); joinIndex < joinCount; joinIndex++) {
            Map.Entry<Join, String> joinEntry = joinEntries.get(joinIndex);
            Join join = joinEntry.getKey();

            // Retrieve the identification variable from the join association path
            String variableName = queryContext.literal(
              join.getJoinAssociationPath(),
              LiteralType.PATH_EXPRESSION_IDENTIFICATION_VARIABLE
            );

            // Make sure the identification variable is defined before the JOIN expression
            if (ExpressionTools.stringIsNotEmpty(variableName) &&
                !isIdentificationVariableDeclaredBefore(variableName, index, joinIndex, declarations)) {

              int startPosition = position(join.getJoinAssociationPath());
              int endPosition   = startPosition + variableName.length();

              addProblem(
                expression,
                startPosition,
                endPosition,
                AbstractFromClause_WrongOrderOfIdentificationVariableDeclaration,
                variableName
              );
            }
          }
        }
        // Check the collection member declaration
        else if (!declaration.isRange()) {

          // Retrieve the identification variable from the path expression
          String variableName = queryContext.literal(
            declaration.getBaseExpression(),
            LiteralType.PATH_EXPRESSION_IDENTIFICATION_VARIABLE
          );

          if (ExpressionTools.stringIsNotEmpty(variableName) &&
              !isIdentificationVariableDeclaredBefore(variableName, index, -1, declarations)) {

            int startPosition = position(declaration.getDeclarationExpression()) - variableName.length();
            int endPosition   = startPosition + variableName.length();

            addProblem(
              expression,
              startPosition,
View Full Code Here

  protected void convertUnqualifiedDeclaration(Declaration declaration) {

    if (parent != null) {

      // Retrieve the range identification variable from the parent declaration
      Declaration parentDeclaration = parent.getDeclarationResolverImp().getDeclarations().get(0);
      String outerVariableName = parentDeclaration.getVariableName();

      // Qualify the range expression to be fully qualified
      getDeclarationResolverImp().convertUnqualifiedDeclaration(declaration, outerVariableName);
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jpa.internal.jpql.DeclarationResolver.Declaration

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.