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

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


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

    Expression firstExpression  = expression.getFirstExpression();
    Expression secondExpression = expression.getSecondExpression();

    // The first two expressions should be a string
    if (firstExpression .isAncestor(inputParameter) ||
        secondExpression.isAncestor(inputParameter)) {

      this.type = String.class;
    }
    // It either returns an integer or the third argument is an integer
    else {
View Full Code Here


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

    Expression patternValue = expression.getPatternValue();
    Expression stringExpression = expression.getStringExpression();

    if (patternValue.isAncestor(inputParameter)) {
      this.expression = expression.getStringExpression();
    }
    else if (stringExpression.isAncestor(inputParameter)) {
      this.expression = expression;
    }
  }
View Full Code Here

    // - used as a "root" object in the top-level FROM clause
    // - defined in a UNION clause
    // - used in an IN expression
    // If the flag is false, then the SELECT clause is from a subquery
    if (!multipleSelectItemsAllowed) {
      Expression parent = expression.getParent();
      multipleSelectItemsAllowed = isOwnedByFromClause  (parent) ||
                                   isOwnedByUnionClause (parent) ||
                                   isOwnedByInExpression(parent);
    }
View Full Code Here

          endPosition,
          RegexpExpression_MissingStringExpression
        );
      }
      else {
        Expression stringExpression = expression.getStringExpression();

        // Invalid string expression
        if (!isValid(stringExpression, StringExpressionBNF.ID)) {

          int startPosition = position(stringExpression);
          int endPosition   = startPosition + length(stringExpression);

          addProblem(
            expression,
            startPosition,
            endPosition,
            RegexpExpression_InvalidStringExpression
          );
        }
        // Validate string expression
        else {
          stringExpression.accept(this);
        }
      }

      // Missing pattern value
      if (!expression.hasPatternValue()) {

        int startPosition = position(expression) +
                            length(expression.getStringExpression()) +
                            (expression.hasSpaceAfterStringExpression() ? 1 : 0) +
                            6 /* REGEXP */ +
                            (expression.hasSpaceAfterIdentifier() ? 1 : 0);

        int endPosition = startPosition;

        addProblem(expression, startPosition, endPosition, RegexpExpression_MissingPatternValue);
      }
      else {
        Expression patternValue = expression.getStringExpression();

        // Invalid string expression
        if (!isValid(patternValue, PatternValueBNF.ID)) {

          int startPosition = position(expression) +
                              length(expression.getStringExpression()) +
                              (expression.hasSpaceAfterStringExpression() ? 1 : 0) +
                              6 /* REGEXP */ +
                              (expression.hasSpaceAfterIdentifier() ? 1 : 0);

          int endPosition = startPosition + length(patternValue);

          addProblem(
            expression,
            startPosition,
            endPosition,
            RegexpExpression_InvalidPatternValue
          );
        }
        // Validate pattern value
        else {
          patternValue.accept(this);
        }
      }
    }
  }
View Full Code Here

    // - used as a "root" object in the top-level FROM clause
    // - defined in a UNION clause
    // - used in an IN expression
    // If the flag is false, then the SELECT clause is from a subquery
    if (!multipleSelectItemsAllowed) {
      Expression parent = expression.getParent();
      multipleSelectItemsAllowed = isOwnedByFromClause  (parent) ||
                                   isOwnedByUnionClause (parent) ||
                                   isOwnedByInExpression(parent);
    }
View Full Code Here

          endPosition,
          RegexpExpression_MissingStringExpression
        );
      }
      else {
        Expression stringExpression = expression.getStringExpression();

        // Invalid string expression
        if (!isValid(stringExpression, StringExpressionBNF.ID)) {

          int startPosition = position(stringExpression);
          int endPosition   = startPosition + length(stringExpression);

          addProblem(
            expression,
            startPosition,
            endPosition,
            RegexpExpression_InvalidStringExpression
          );
        }
        // Validate string expression
        else {
          stringExpression.accept(this);
        }
      }

      // Missing pattern value
      if (!expression.hasPatternValue()) {

        int startPosition = position(expression) +
                            length(expression.getStringExpression()) +
                            (expression.hasSpaceAfterStringExpression() ? 1 : 0) +
                            6 /* REGEXP */ +
                            (expression.hasSpaceAfterIdentifier() ? 1 : 0);

        int endPosition = startPosition;

        addProblem(expression, startPosition, endPosition, RegexpExpression_MissingPatternValue);
      }
      else {
        Expression patternValue = expression.getStringExpression();

        // Invalid string expression
        if (!isValid(patternValue, PatternValueBNF.ID)) {

          int startPosition = position(expression) +
                              length(expression.getStringExpression()) +
                              (expression.hasSpaceAfterStringExpression() ? 1 : 0) +
                              6 /* REGEXP */ +
                              (expression.hasSpaceAfterIdentifier() ? 1 : 0);

          int endPosition = startPosition + length(patternValue);

          addProblem(
            expression,
            startPosition,
            endPosition,
            RegexpExpression_InvalidPatternValue
          );
        }
        // Validate pattern value
        else {
          patternValue.accept(this);
        }
      }
    }
  }
View Full Code Here

     * {@inheritDoc}
     */
    public boolean isClauseComplete(DeleteStatement expression) {

      DeleteClause deleteClause = expression.getDeleteClause();
      Expression declaration = deleteClause.getRangeVariableDeclaration();
      boolean complete = isValid(declaration, RangeVariableDeclarationBNF.ID);

      if (complete) {
        complete = isComplete(declaration);
      }
View Full Code Here

     * {@inheritDoc}
     */
    public boolean isClauseComplete(DeleteStatement expression) {

      DeleteClause deleteClause = expression.getDeleteClause();
      Expression declaration = deleteClause.getRangeVariableDeclaration();
      boolean complete = isValid(declaration, RangeVariableDeclarationBNF.ID);

      if (complete) {
        complete = isComplete(declaration);
      }
View Full Code Here

      int index = expression.childrenSize();

      // Find the index of the expression for which the tree is been visited
      while (--index >= 0) {
        Expression child = expression.getChild(index);

        if (child == this.expression) {
          break;
        }
      }

      // Check to see if an expression before the index is invalid
      while (--index >= 0) {
        Expression child = expression.getChild(index);
        followingInvalidExpression = isInvalidExpression(child);

        if (followingInvalidExpression) {
          index = -1;
        }
View Full Code Here

      int index = expression.childrenSize();

      // Find the index of the expression for which the tree is been visited
      while (--index >= 0) {
        Expression child = expression.getChild(index);

        if (child == this.expression) {
          break;
        }
      }

      // Check to see if an expression before the index is invalid
      while (--index >= 0) {
        Expression child = expression.getChild(index);
        followingInvalidExpression = isInvalidExpression(child);

        if (followingInvalidExpression) {
          index = -1;
        }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jpa.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.