Пример #1
0
  /**
   * The returned List will contain objects of the default type or objects that inherit from the
   * default.
   *
   * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a
   *     TorqueException.
   */
  public static List<TScreenTab> populateObjects(List<Record> records) throws TorqueException {
    List<TScreenTab> results = new ArrayList<TScreenTab>(records.size());

    // populate the object(s)
    for (int i = 0; i < records.size(); i++) {
      Record row = records.get(i);
      results.add(TScreenTabPeer.row2Object(row, 1, TScreenTabPeer.getOMClass()));
    }
    return results;
  }
Пример #2
0
  /**
   * selects a collection of TScreenTab objects pre-filled with their TScreen objects.
   *
   * <p>This method is protected by default in order to keep the public api reasonable. You can
   * provide public methods for those you actually need in TScreenTabPeer.
   *
   * @throws TorqueException Any exceptions caught during processing will be rethrown wrapped into a
   *     TorqueException.
   */
  protected static List<TScreenTab> doSelectJoinTScreen(Criteria criteria, Connection conn)
      throws TorqueException {
    setDbName(criteria);

    TScreenTabPeer.addSelectColumns(criteria);
    int offset = numColumns + 1;
    TScreenPeer.addSelectColumns(criteria);

    criteria.addJoin(TScreenTabPeer.PARENT, TScreenPeer.OBJECTID);

    correctBooleans(criteria);

    List<Record> rows;
    if (conn == null) {
      rows = BasePeer.doSelect(criteria);
    } else {
      rows = BasePeer.doSelect(criteria, conn);
    }

    List<TScreenTab> results = new ArrayList<TScreenTab>();

    for (int i = 0; i < rows.size(); i++) {
      Record row = rows.get(i);

      Class omClass = TScreenTabPeer.getOMClass();
      TScreenTab obj1 = (TScreenTab) TScreenTabPeer.row2Object(row, 1, omClass);
      omClass = TScreenPeer.getOMClass();
      TScreen obj2 = (TScreen) TScreenPeer.row2Object(row, offset, omClass);

      boolean newObject = true;
      for (int j = 0; j < results.size(); j++) {
        TScreenTab temp_obj1 = results.get(j);
        TScreen temp_obj2 = (TScreen) temp_obj1.getTScreen();
        if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) {
          newObject = false;
          temp_obj2.addTScreenTab(obj1);
          break;
        }
      }
      if (newObject) {
        obj2.initTScreenTabs();
        obj2.addTScreenTab(obj1);
      }
      results.add(obj1);
    }
    return results;
  }