Examples of ASTIterator


Examples of org.hibernate.hql.ast.util.ASTIterator

    parse("select distinct user.party from com.itf.iceclaims.domain.party.user.UserImpl user inner join user.party.$RelatedWorkgroups relatedWorkgroups where relatedWorkgroups.workgroup.id = :workgroup and relatedWorkgroups.effectiveTime.start <= :datesnow and relatedWorkgroups.effectiveTime.end > :dateenow ");
  }
  public void testLineAndColumnNumber() throws Exception {
    AST ast = doParse("from Foo f\nwhere f.name = 'fred'",false);
    // Find some of the nodes and check line and column values.
    ASTIterator iter = new ASTIterator(ast);
    boolean foundFoo = false;
    boolean foundName = false;
    while (iter.hasNext())
    {
      AST n = iter.nextNode();
      if ("Foo".equals(n.getText()))
      {
        if (foundFoo)
          fail("Already found 'Foo'!");
        foundFoo = true;
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTIterator

    HqlParser parser = HqlParser.getInstance( input );
    parser.statement();
    AST ast = parser.getAST();
    ASTPrinter printer = new ASTPrinter( HqlTokenTypes.class );
    printer.showAst( ast, new PrintWriter( System.out ) );
    ASTIterator iterator = new ASTIterator( ast );
    int count = 0;
    while ( iterator.hasNext() ) {
      assertTrue( iterator.next() instanceof AST );
      count++;
    }
    assertEquals( 43, count );

    UnsupportedOperationException uoe = null;
    try {
      iterator.remove();
    }
    catch ( UnsupportedOperationException e ) {
      uoe = e;
    }
    assertNotNull( uoe );
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTIterator

      System.out.println( n );
    }
    assertEquals( 10, count );

    System.out.println( "--- ASTIterator ---" );
    ASTIterator iter2 = new ASTIterator( t );
    int count2 = 0;
    while ( iter2.hasNext() ) {
      AST n = iter2.nextNode();
      count2++;
      System.out.println( n );
    }
    assertEquals( 10, count2 );
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTIterator

    parse("select distinct user.party from com.itf.iceclaims.domain.party.user.UserImpl user inner join user.party.$RelatedWorkgroups relatedWorkgroups where relatedWorkgroups.workgroup.id = :workgroup and relatedWorkgroups.effectiveTime.start <= :datesnow and relatedWorkgroups.effectiveTime.end > :dateenow ");
  }
  public void testLineAndColumnNumber() throws Exception {
    AST ast = doParse("from Foo f\nwhere f.name = 'fred'",false);
    // Find some of the nodes and check line and column values.
    ASTIterator iter = new ASTIterator(ast);
    boolean foundFoo = false;
    boolean foundName = false;
    while (iter.hasNext())
    {
      AST n = iter.nextNode();
      if ("Foo".equals(n.getText()))
      {
        if (foundFoo)
          fail("Already found 'Foo'!");
        foundFoo = true;
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTIterator

    parse("select distinct user.party from com.itf.iceclaims.domain.party.user.UserImpl user inner join user.party.$RelatedWorkgroups relatedWorkgroups where relatedWorkgroups.workgroup.id = :workgroup and relatedWorkgroups.effectiveTime.start <= :datesnow and relatedWorkgroups.effectiveTime.end > :dateenow ");
  }
  public void testLineAndColumnNumber() throws Exception {
    AST ast = doParse("from Foo f\nwhere f.name = 'fred'",false);
    // Find some of the nodes and check line and column values.
    ASTIterator iter = new ASTIterator(ast);
    boolean foundFoo = false;
    boolean foundName = false;
    while (iter.hasNext())
    {
      AST n = iter.nextNode();
      if ("Foo".equals(n.getText()))
      {
        if (foundFoo)
          fail("Already found 'Foo'!");
        foundFoo = true;
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTIterator

    HqlParser parser = HqlParser.getInstance( input );
    parser.statement();
    AST ast = parser.getAST();
    ASTPrinter printer = new ASTPrinter( HqlTokenTypes.class );
    printer.showAst( ast, new PrintWriter( System.out ) );
    ASTIterator iterator = new ASTIterator( ast );
    int count = 0;
    while ( iterator.hasNext() ) {
      assertTrue( iterator.next() instanceof AST );
      count++;
    }
    assertEquals( 43, count );

    UnsupportedOperationException uoe = null;
    try {
      iterator.remove();
    }
    catch ( UnsupportedOperationException e ) {
      uoe = e;
    }
    assertNotNull( uoe );
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTIterator

      System.out.println( n );
    }
    assertEquals( 10, count );

    System.out.println( "--- ASTIterator ---" );
    ASTIterator iter2 = new ASTIterator( t );
    int count2 = 0;
    while ( iter2.hasNext() ) {
      AST n = iter2.nextNode();
      count2++;
      System.out.println( n );
    }
    assertEquals( 10, count2 );
View Full Code Here

Examples of org.hibernate.hql.internal.ast.util.ASTIterator

    if ( fromElement.getQueryableCollection() != null && fromElement.isFetch() ) {
      text = fromElement.renderCollectionSelectFragment( nonscalarSize, k );
      appender.append( SqlTokenTypes.SQL_TOKEN, text, false );
    }
    // Look through the FromElement's children to find any collections of values that should be fetched...
    ASTIterator iter = new ASTIterator( fromElement );
    while ( iter.hasNext() ) {
      FromElement child = (FromElement) iter.next();
      if ( child.isCollectionOfValuesOrComponents() && child.isFetch() ) {
        // Need a better way to define the suffixes here...
        text = child.renderValueCollectionSelectFragment( nonscalarSize, nonscalarSize + k );
        appender.append( SqlTokenTypes.SQL_TOKEN, text, false );
      }
View Full Code Here

Examples of org.hibernate.hql.internal.ast.util.ASTIterator

    return fromElementCounter++;
  }

  public void resolve() {
    // Make sure that all from elements registered with this FROM clause are actually in the AST.
    ASTIterator iter = new ASTIterator( this.getFirstChild() );
    Set childrenInTree = new HashSet();
    while ( iter.hasNext() ) {
      childrenInTree.add( iter.next() );
    }
    for ( FromElement fromElement : fromElements ) {
      if ( !childrenInTree.contains( fromElement ) ) {
        throw new IllegalStateException( "Element not in AST: " + fromElement );
      }
View Full Code Here

Examples of org.hibernate.hql.internal.ast.util.ASTIterator

    return fromElementCounter++;
  }

  public void resolve() {
    // Make sure that all from elements registered with this FROM clause are actually in the AST.
    ASTIterator iter = new ASTIterator( this.getFirstChild() );
    Set childrenInTree = new HashSet();
    while ( iter.hasNext() ) {
      childrenInTree.add( iter.next() );
    }
    for ( Iterator iterator = fromElements.iterator(); iterator.hasNext(); ) {
      FromElement fromElement = ( FromElement ) iterator.next();
      if ( !childrenInTree.contains( fromElement ) ) {
        throw new IllegalStateException( "Element not in AST: " + fromElement );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.