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 org.apache.commons.lang.StringUtils;
    10  import org.asyrinx.joey.gen.model.rdb.Index;
    11  import org.asyrinx.joey.gen.model.rdb.IndexEntry;
    12  import org.asyrinx.joey.gen.model.rdb.Table;
    13
    14  /***
    15   * @author akima
    16   */
    17  public class CheckIndexEntry extends RdbCommand {
    18
    19      public void visit(IndexEntry indexEntry) {
    20          if (StringUtils.isEmpty(indexEntry.getName()))
    21              addError(indexEntry, "indexEntry requires name");
    22          final Index index = indexEntry.getParent();
    23          final Table table = index.getParent();
    24          if (table.getColumns().getColumn(indexEntry.getName()) == null)
    25              addError(indexEntry, "column not found");
    26      }
    27
    28  }