View Javadoc

    1   /*
    2    * joey-gen and its relative products are published under the terms
    3    * of the Apache Software License.
    4    *
    5    * Created on 2004/08/15 18:00:19
    6    */
    7   package org.asyrinx.joey.gen.command.rdb;
    8
    9   import java.util.Iterator;
    10
    11  import org.asyrinx.joey.gen.model.rdb.Column;
    12  import org.asyrinx.joey.gen.model.rdb.Table;
    13
    14  /***
    15   * @author akima
    16   */
    17  public class CheckPrimaryKey extends RdbCommand {
    18
    19      public void visit(Table table) {
    20          for (Iterator i = table.getColumns().iterator(); i.hasNext();) {
    21              final Column column = (Column) i.next();
    22              if (column.isPrimaryKey())
    23                  return;
    24          }
    25          addError(table, "table has no primary key!");
    26      }
    27
    28  }