コード例 #1
0
  private boolean shouldStopVisiting(TableNode tableNode) {

    if (inRecursiveRelation(tableNode)) {
      if (recursivelyVisited(tableNode)) return true;

    } else {
      if (ctx.tableAlreadyVisited(tableNode.getTable())) return true;
    }

    return false;
  }
コード例 #2
0
  /*
   * Implements the relational tree traversal
   */
  public void visit(TableNode tableNode, boolean baseTable) {

    ctx.createTableContext(tableNode);

    if (baseTable) ctx.setBaseTable(tableNode.getTable());

    if (baseTable) onVisitBaseTable(tableNode);
    else {
      onVisitRelatedTable(tableNode);
    }

    if (inRecursiveRelation(tableNode)) {
      ctx.setVisitedRecursion(tableNode.getTable());
      if (ctx.isInLazyQuery()) ctx.setVisitedTable(tableNode.getTable(), tableNode);
    }

    // Add
    if (shouldStopVisiting(tableNode)) return;
    ctx.setVisitedTable(tableNode.getTable(), tableNode);

    for (RelationNode relationNode : tableNode.getChildren()) {
      if (eligibleForVisitation(relationNode, tableNode)) {
        //				relationNode.setRelContextManager(ctx); //pass the context to the node
        Fetching relationFecthing = getFetchingForRelationNode(relationNode);
        if (fetching == null
            || fetching.equals(relationFecthing)
            || allowedForVisitation(relationNode)) {
          if (traversedLazyRelation(
              relationFecthing,
              relationNode)) // stop if we reached the tableNode by traversing a relation with lazy
            // fetching
            continue;
          for (TableNode childTableNode : relationNode.getChildren()) {
            visit(childTableNode, false);
          }
          onVisitedTableRelation(relationNode);
        }
      }
    }
  }
コード例 #3
0
 private boolean recursivelyVisited(TableNode tableNode) {
   return ctx.recursionAlreadyVisited(tableNode.getTable());
 }