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

Examples of org.eclipse.persistence.jpa.internal.jpql.parser.Expression


    if ((helper == null) || !helper.hasClause(expression)) {
      return false;
    }

    Expression clause = helper.getClause(expression);
    Expression clauseExpression = helper.getClauseExpression(clause);
    return helper.isClauseExpressionComplete(clauseExpression);
  }
View Full Code Here


      // After "<collection-valued path expression> "
      if (expression.hasCollectionValuedPathExpression() &&
          expression.hasSpaceAfterCollectionValuedPathExpression()) {

        Expression collectionValuedPathExpression = expression.getCollectionValuedPathExpression();
        length += length(collectionValuedPathExpression) + SPACE_LENGTH;

        // Within "AS"
        if (isPositionWithin(position, length, AS)) {
          proposals.addIdentifier(AS);
View Full Code Here

      if (position == length) {
        helper.addProposals(expression);
      }
      // Somewhere in the clause's expression
      else {
        Expression clauseExpression = helper.getClauseExpression(expression);
        int clauseExpressionLength = length(clauseExpression);

        // At the end of the clause's expression
        if (position == length + clauseExpressionLength + virtualSpaces.peek()) {

          virtualSpaces.add(SPACE_LENGTH);
          corrections.add(-clauseExpressionLength - 2);

          clauseExpression.accept(this);

          // Now ask the helper to add possible identifiers at the end of its expression
          if (isComplete(clauseExpression)) {
            helper.addAtTheEndOfExpression(expression);
          }
View Full Code Here

        // than the expession's grammar would actually allow. The content assist will only
        // provide assistance from the first child to the last allowed child
        int count = Math.min(collectionExpression.childrenSize(), helper.maxCollectionSize(expression));

        for (int index = 0; index < count; index++) {
          Expression child = collectionExpression.getChild(index);
          int childLength = 0;

          // At the beginning of the child expression
          if (position == length) {
            helper.addProposals(expression, index);
View Full Code Here

      return null;
    }

    if (helper.hasClause(expression)) {
      Expression clause = helper.getClause(expression);

      // Check for within the clause
      if (position > length[0]) {
        int clauseLength = length(clause);
        length[0] += clauseLength;
        boolean hasSpaceAfterIdentifier = helper.hasSpaceAfterClause(expression);
        Expression clauseExpression = helper.getClauseExpression(clause);

        // At the end of the clause, check for adding proposals based
        // on possible incomplete information
        if (position == length[0]) {
          helper.appendNextClauseProposals(expression, clause, position, false);
View Full Code Here

      addProblem(expression, startPosition, endPosition, missingConditionalExpressionMessageKey);
    }
    // Invalid conditional expression
    else {
      Expression conditionalExpression = expression.getConditionalExpression();

      if (!isValid(conditionalExpression, ConditionalExpressionBNF.ID)) {
        int startPosition = position(conditionalExpression);
        int endPosition   = startPosition + length(conditionalExpression);
        addProblem(expression, startPosition, endPosition, invalidConditionalExpressionMessageKey);
View Full Code Here

    // More than one entity abstract schema type is declared
    CollectionExpression collectionExpression = collectionExpression(expression.getRangeVariableDeclaration());

    if (collectionExpression != null) {
      Expression firstChild = collectionExpression.getChild(0);
      int startPosition = position(firstChild) + length(firstChild);
      int endPosition = position(collectionExpression) + length(collectionExpression);
      boolean malformed = false;

      for (int index = collectionExpression.childrenSize() - 1; --index >= 0; ) {
View Full Code Here

      int endPosition   = startPosition;
      addProblem(expression, startPosition, endPosition, InExpression_MissingExpression);
    }
    // Make sure it's a valid expression
    else {
      Expression pathExpression = expression.getExpression();

      if (!isValid(pathExpression, StateFieldPathExpressionBNF.ID) &&
          !isValid(pathExpression, TypeExpressionBNF.ID)) {

        int startPosition = position(expression);
View Full Code Here

        startPosition++;
      }

      // Validate the escape character
      if (expression.hasEscapeCharacter()) {
         Expression escapeCharacter = expression.getEscapeCharacter();
         int endPosition = startPosition + length(escapeCharacter);

         // Check for a string literal (single quoted character)
         String character = queryContext.literal(escapeCharacter, LiteralType.STRING_LITERAL);

         if (character.length() > 0) {
           character = ExpressionTools.unquote(character);

           if (character.length() != 1) {
             addProblem(
               expression,
               startPosition,
               endPosition,
               LikeExpression_InvalidEscapeCharacter,
               escapeCharacter.toParsedText()
             );
           }
         }
         else {
           // Check for an input parameter
           character = queryContext.literal(escapeCharacter, LiteralType.INPUT_PARAMETER);

           if (character.length() == 0) {
             addProblem(
              expression,
              startPosition,
              endPosition,
              LikeExpression_InvalidEscapeCharacter,
              escapeCharacter.toParsedText()
            );
           }
         }
       }
       else {
View Full Code Here

  @Override
  public void visit(SimpleSelectClause expression) {

    // Select expression cannot be a collection
    if (expression.hasSelectExpression()) {
      Expression selectExpression = expression.getSelectExpression();

      if (collectionExpression(selectExpression) != null) {
        addProblem(
          selectExpression,
          SimpleSelectClause_NotSingleExpression,
          selectExpression.toParsedText()
        );
      }

      super.visit(expression);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jpa.internal.jpql.parser.Expression

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.