public String getColumn(String parentCol) {
   // return the associated column given the parent column
   Object key = parentColumns.getKeyForValue(parentCol);
   String col = (String) columns.get(key);
   // System.out.println("get Column for" +parentCol);
   // System.out.println("key = "+key);
   // System.out.println("col="+col);
   // System.out.println("ParentColumns = "+parentColumns.toString());
   return col;
 }
Exemplo n.º 2
0
  /**
   * @param tableName
   * @param columnName
   * @param seq
   */
  public void addForeignKey(String tableName, String columnName, String parentColumn, Integer seq) {
    ForeignKey tbl = null;
    if (associatedTables.containsKey(tableName)) {
      tbl = (ForeignKey) associatedTables.get(tableName);
    } else {
      tbl = new ForeignKey(parentTable, tableName);
      associatedTables.put(tableName, tbl);
    }

    tbl.addColumn(columnName, parentColumn, seq);
  }
  private boolean hasAllPrimaryKeys(List pkeys, ListHashtable cols) {
    boolean hasAll = true;
    // if size is not equal then false
    int numKeys = pkeys.size();
    if (numKeys != cols.size()) return false;

    for (int i = 0; i < numKeys; i++) {
      Column col = (Column) pkeys.get(i);
      String colname = col.getColumnName();
      if (!cols.contains(colname)) return false;
    }

    return hasAll;
  }
Exemplo n.º 4
0
 public List<Table> listMapToList() {
   List<Table> tables = new ArrayList<Table>();
   Table t;
   for (Iterator it = associatedTables.keySet().iterator(); it.hasNext(); ) {
     String tableName = (String) it.next();
     t = new Table();
     t.setSqlName(tableName);
     tables.add(t);
     // 放进tables中
   }
   return tables;
 }
 /**
  * @param col
  * @param seq
  */
 public void addColumn(String col, String parentCol, Integer seq) {
   columns.put(seq, col);
   parentColumns.put(seq, parentCol);
 }