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

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


    expression.getEntityExpression().accept(this);
    Expression entityExpression = queryExpression;

    if (expression.hasNot()) {

      CollectionValuedPathExpression pathExpression = (CollectionValuedPathExpression) expression.getCollectionValuedPathExpression();

      // Retrieve the ExpressionBuilder from the collection-valued path expression's
      // identification variable and the variable name
      pathExpression.getIdentificationVariable().accept(this);
      Expression parentExpression = queryExpression;

      // Now create the actual expression
      Expression newBuilder = new ExpressionBuilder();
      Expression collectionBase = newBuilder;
            for (int i = 1; i < pathExpression.pathSize() - 1; i++) {
                // nested paths must be single valued.
                collectionBase = collectionBase.get(pathExpression.getPath(i));
            }
            String lastPath = pathExpression.getPath(pathExpression.pathSize() - 1);
            // The following code is copied from Expression.noneOf and altered a bit
            Expression criteria = newBuilder.equal(parentExpression).and(collectionBase.anyOf(lastPath).equal(entityExpression));
            ReportQuery subQuery = new ReportQuery();
            subQuery.setShouldRetrieveFirstPrimaryKey(true);
            subQuery.setSelectionCriteria(criteria);
View Full Code Here


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

    CollectionValuedPathExpression collectionPath = (CollectionValuedPathExpression) expression.getExpression();
    int lastPathIndex = collectionPath.pathSize() - 1;
    String name = collectionPath.getPath(lastPathIndex);

    // Create the expression for the collection-valued path expression (except the last path)
    visitPathExpression(collectionPath, false, lastPathIndex);

    // Create the IS EMPTY expression
View Full Code Here

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

    CollectionValuedPathExpression pathExpression = (CollectionValuedPathExpression) expression.getExpression();
    int lastIndex = pathExpression.pathSize() - 1;

    // Create the right chain of expressions
    visitPathExpression(pathExpression, false, lastIndex - 1);

    // Now create the SIZE expression
    String name = pathExpression.getPath(lastIndex);
    queryExpression = queryExpression.size(name);

    // Set the expression type
    type[0] = Integer.class;
  }
View Full Code Here

                                                           boolean collectionTypeOnly) {

    boolean valid = true;

    // The path expression resolves to a collection-valued path expression
    CollectionValuedPathExpression collectionValuedPathExpression = getCollectionValuedPathExpression(expression);

    if (collectionValuedPathExpression != null &&
        collectionValuedPathExpression.hasIdentificationVariable() &&
       !collectionValuedPathExpression.endsWithDot()) {

      // A collection_valued_field is designated by the name of an association field in a
      // one-to-many or a many-to-many relationship or by the name of an element collection field
      Object mapping = helper.resolveMapping(expression);
      Object type = helper.getMappingType(mapping);
View Full Code Here

    Expression rootObject = expression.getRootObject();

    // Special case, the path expression could be a fully qualified class name,
    // make sure to not validate it as collection-valued path expression
    CollectionValuedPathExpression pathExpression = getCollectionValuedPathExpression(rootObject);

    if (pathExpression != null) {
      String path = pathExpression.toActualText();

      // The path expression is not a fully qualified class name
      if (helper.getType(path) == null) {
        pathExpression.accept(this);
      }
    }
    else {
      rootObject.accept(this);
    }
View Full Code Here

    expression.getEntityExpression().accept(this);
    Expression entityExpression = queryExpression;

    if (expression.hasNot()) {

      CollectionValuedPathExpression pathExpression = (CollectionValuedPathExpression) expression.getCollectionValuedPathExpression();

      // Retrieve the ExpressionBuilder from the collection-valued path expression's
      // identification variable and the variable name
      pathExpression.getIdentificationVariable().accept(this);
      Expression parentExpression = queryExpression;

      // Now create the actual expression
      Expression newBuilder = new ExpressionBuilder();
      Expression collectionBase = newBuilder;
            for (int i = 1; i < pathExpression.pathSize() - 1; i++) {
                // nested paths must be single valued.
                collectionBase = collectionBase.get(pathExpression.getPath(i));
            }
            String lastPath = pathExpression.getPath(pathExpression.pathSize() - 1);
            // The following code is copied from Expression.noneOf and altered a bit
            Expression criteria = newBuilder.equal(parentExpression).and(collectionBase.anyOf(lastPath).equal(entityExpression));
            ReportQuery subQuery = new ReportQuery();
            subQuery.setShouldRetrieveFirstPrimaryKey(true);
            subQuery.setSelectionCriteria(criteria);
View Full Code Here

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

    CollectionValuedPathExpression collectionPath = (CollectionValuedPathExpression) expression.getExpression();
    int lastPathIndex = collectionPath.pathSize() - 1;
    String name = collectionPath.getPath(lastPathIndex);

    // Create the expression for the collection-valued path expression (except the last path)
    visitPathExpression(collectionPath, false, lastPathIndex);

    // Create the IS EMPTY expression
View Full Code Here

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

    CollectionValuedPathExpression pathExpression = (CollectionValuedPathExpression) expression.getExpression();
    int lastIndex = pathExpression.pathSize() - 1;

    // Create the right chain of expressions
    visitPathExpression(pathExpression, false, lastIndex - 1);

    // Now create the SIZE expression
    String name = pathExpression.getPath(lastIndex);
    queryExpression = queryExpression.size(name);

    // Set the expression type
    type[0] = Integer.class;
  }
View Full Code Here

    Expression rootObject = expression.getRootObject();

    // Special case, the path expression could be a fully qualified class name,
    // make sure to not validate it as collection-valued path expression
    CollectionValuedPathExpression pathExpression = getCollectionValuedPathExpression(rootObject);

    if (pathExpression != null) {
      String path = pathExpression.toActualText();

      // The path expression is not a fully qualified class name
      if (helper.getType(path) == null) {
        pathExpression.accept(this);
      }
    }
    else {
      rootObject.accept(this);
    }
View Full Code Here

                                                           boolean collectionTypeOnly) {

    boolean valid = true;

    // The path expression resolves to a collection-valued path expression
    CollectionValuedPathExpression collectionValuedPathExpression = getCollectionValuedPathExpression(expression);

    if (collectionValuedPathExpression != null &&
        collectionValuedPathExpression.hasIdentificationVariable() &&
       !collectionValuedPathExpression.endsWithDot()) {

      // A collection_valued_field is designated by the name of an association field in a
      // one-to-many or a many-to-many relationship or by the name of an element collection field
      Object mapping = helper.resolveMapping(expression);
      Object type = helper.getMappingType(mapping);
View Full Code Here

TOP

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

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.