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

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


    // Validate range variable declaration
    if (expression.hasRangeVariableDeclaration()) {

      // More than one entity abstract schema type is declared
      CollectionExpression collectionExpression = getCollectionExpression(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; ) {
          if (!collectionExpression.hasComma(index)) {
            malformed = true;
          }
        }

        if (collectionExpression.toActualText().endsWith(" ")) {
          endPosition--;
        }

        addProblem(
          expression,
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public CollectionExpression buildCollectionExpression(IdentificationVariableDeclaration expression) {
      CollectionExpression collectionExpression = getCollectionExpression(expression.getJoins());
      if (collectionExpression == null) {
        collectionExpression = expression.buildCollectionExpression();
      }
      return collectionExpression;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public CollectionExpression buildCollectionExpression(OrderByClause expression) {
      CollectionExpression collectionExpression = getCollectionExpression(expression.getOrderByItems());
      if (collectionExpression == null) {
        collectionExpression = expression.buildCollectionExpression();
      }
      return collectionExpression;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public CollectionExpression buildCollectionExpression(ConstructorExpression expression) {
      CollectionExpression collectionExpression = getCollectionExpression(expression.getConstructorItems());
      if (collectionExpression == null) {
        collectionExpression = expression.buildCollectionExpression();
      }
      return collectionExpression;
    }
View Full Code Here

    Expression selectExpression = expression.getSelectExpression();

    // visit(CollectionExpression) iterates through the children but for a
    // SELECT clause, a CollectionExpression means the result type is Object[]
    CollectionExpression collectionExpression = getCollectionExpression(selectExpression);

    if (collectionExpression != null) {
      type = Object[].class;
    }
    else {
View Full Code Here

   */
  private void visitCollectionEquivalentExpression(Expression expression,
                                                   Expression extraExpression) {

    List<Class<?>> types = new ArrayList<Class<?>>();
    CollectionExpression collectionExpression = getCollectionExpression(expression);

    // Gather the resolver for all children
    if (collectionExpression != null) {
      for (Expression child : collectionExpression.children()) {
        child.accept(this);
        types.add(type);
      }
    }
    // Otherwise visit the actual expression
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public CollectionExpression buildCollectionExpression(AbstractFromClause expression) {
      CollectionExpression collectionExpression = getCollectionExpression(expression.getDeclaration());
      if (collectionExpression == null) {
        collectionExpression = expression.buildCollectionExpression();
      }
      return collectionExpression;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public CollectionExpression buildCollectionExpression(GroupByClause expression) {
      CollectionExpression collectionExpression = getCollectionExpression(expression.getGroupByItems());
      if (collectionExpression == null) {
        collectionExpression = expression.buildCollectionExpression();
      }
      return collectionExpression;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public CollectionExpression buildCollectionExpression(UpdateClause expression) {
      CollectionExpression collectionExpression = getCollectionExpression(expression.getUpdateItems());
      if (collectionExpression == null) {
        collectionExpression = expression.buildCollectionExpression();
      }
      return collectionExpression;
    }
View Full Code Here

  protected void addSelectExpressionProposals(AbstractSelectClause expression, int length) {

    int position = getPosition(expression) - corrections.peek();

    // Now check for inside the select expression
    CollectionExpression collectionExpression = getCollectionExpression(expression.getSelectExpression());

    if (collectionExpression != null) {

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

        // At the beginning of the child expression
        if (position == length) {
          addAllIdentificationVariables();
          addAllFunctions(expression.selectItemBNF());
          break;
        }
        else {
          boolean withinChild = addSelectExpressionProposals(
            child,
            expression.selectItemBNF(),
            length,
            index,
            index + 1 == count
          );

          if (withinChild) {
            break;
          }
        }

        length += length(child);

        if (collectionExpression.hasComma(index)) {
          length++;
        }
        // Cannot do anything more since a comma is missing,
        // which means the query is not valid
        else {
          break;
        }

        // After ',', the proposals can be added
        if (position == length) {
          addAllIdentificationVariables();
          addAllFunctions(expression.selectItemBNF());
          break;
        }

        if (collectionExpression.hasSpace(index)) {
          length++;
        }
      }
    }
    else {
View Full Code Here

TOP

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

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.