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      /*
    20       * (non-Javadoc)
    21       *
    22       * @see org.asyrinx.joey.gen.model.rdb.RdbVisitor#visit(org.asyrinx.joey.gen.model.rdb.IndexEntry)
    23       */
    24      public void visit(IndexEntry indexEntry) {
    25          if (StringUtils.isEmpty(indexEntry.getName()))
    26              addError(indexEntry, "indexEntry requires name");
    27          final Index index = indexEntry.getParent();
    28          final Table table = index.getParent();
    29          if (table.getColumns().getColumn(indexEntry.getName()) == null)
    30              addError(indexEntry, "column not found");
    31      }
    32
    33  }