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 14:54:07
    6    */
    7   package org.asyrinx.joey.gen.model.rdb.visitor;
    8
    9   import java.util.Iterator;
    10
    11  import org.asyrinx.joey.gen.model.EnumerationEntry;
    12  import org.asyrinx.joey.gen.model.rdb.Column;
    13  import org.asyrinx.joey.gen.model.rdb.Database;
    14  import org.asyrinx.joey.gen.model.rdb.Databases;
    15  import org.asyrinx.joey.gen.model.rdb.PrimaryKey;
    16  import org.asyrinx.joey.gen.model.rdb.RdbEnumeration;
    17  import org.asyrinx.joey.gen.model.rdb.ForeignKey;
    18  import org.asyrinx.joey.gen.model.rdb.ForeignKeyEntry;
    19  import org.asyrinx.joey.gen.model.rdb.Index;
    20  import org.asyrinx.joey.gen.model.rdb.IndexEntry;
    21  import org.asyrinx.joey.gen.model.rdb.RdbVisitor;
    22  import org.asyrinx.joey.gen.model.rdb.Table;
    23  import org.asyrinx.joey.gen.model.rdb.TablePattern;
    24  import org.asyrinx.joey.gen.model.rdb.TablePatternParam;
    25  import org.asyrinx.joey.gen.model.rdb.Unique;
    26
    27  /***
    28   * @author akima
    29   */
    30  public class RdbTopDownVisitor extends RdbVisitorWrapper {
    31
    32      /***
    33       * @param rdbVisitor
    34       */
    35      public RdbTopDownVisitor(RdbVisitor rdbVisitor) {
    36          super(rdbVisitor);
    37      }
    38
    39      /*
    40       * (non-Javadoc)
    41       *
    42       * @see org.asyrinx.joey.gen.model.rdb.RdbVisitor#visit(org.asyrinx.joey.gen.model.rdb.Column)
    43       */
    44      public void visit(Column column) {
    45          super.visit(column);
    46      }
    47
    48      /*
    49       * (non-Javadoc)
    50       *
    51       * @see org.asyrinx.joey.gen.model.rdb.RdbVisitor#visit(org.asyrinx.joey.gen.model.rdb.Database)
    52       */
    53      public void visit(Database database) {
    54          super.visit(database);
    55          for (Iterator iter = database.getEnumerations().iterator(); iter.hasNext();) {
    56              final RdbEnumeration element = (RdbEnumeration) iter.next();
    57              visit(element);
    58          }
    59          for (Iterator iter = database.getTables().iterator(); iter.hasNext();) {
    60              final Table element = (Table) iter.next();
    61              visit(element);
    62          }
    63      }
    64
    65      /*
    66       * (non-Javadoc)
    67       *
    68       * @see org.asyrinx.joey.gen.model.rdb.RdbVisitor#visit(org.asyrinx.joey.gen.model.rdb.Databases)
    69       */
    70      public void visit(Databases databases) {
    71          super.visit(databases);
    72          for (Iterator iter = databases.getDatabases().iterator(); iter.hasNext();) {
    73              final Database element = (Database) iter.next();
    74              visit(element);
    75          }
    76      }
    77
    78      /*
    79       * (non-Javadoc)
    80       *
    81       * @see org.asyrinx.joey.gen.model.rdb.RdbVisitor#visit(org.asyrinx.joey.gen.model.rdb.JavaEnumeration)
    82       */
    83      public void visit(RdbEnumeration enumeration) {
    84          super.visit(enumeration);
    85          for (Iterator iter = enumeration.iterator(); iter.hasNext();) {
    86              final EnumerationEntry element = (EnumerationEntry) iter.next();
    87              visit(element);
    88          }
    89      }
    90
    91      /*
    92       * (non-Javadoc)
    93       *
    94       * @see org.asyrinx.joey.gen.model.rdb.RdbVisitor#visit(org.asyrinx.joey.gen.model.rdb.EnumerationEntry)
    95       */
    96      public void visit(EnumerationEntry enumerationEntry) {
    97          super.visit(enumerationEntry);
    98      }
    99
    100     /*
    101      * (non-Javadoc)
    102      *
    103      * @see org.asyrinx.joey.gen.model.rdb.RdbVisitor#visit(org.asyrinx.joey.gen.model.rdb.ForeignKey)
    104      */
    105     public void visit(ForeignKey foreignKey) {
    106         super.visit(foreignKey);
    107         for (Iterator iter = foreignKey.iterator(); iter.hasNext();) {
    108             final ForeignKeyEntry element = (ForeignKeyEntry) iter.next();
    109             visit(element);
    110         }
    111     }
    112
    113     /*
    114      * (non-Javadoc)
    115      *
    116      * @see org.asyrinx.joey.gen.model.rdb.RdbVisitor#visit(org.asyrinx.joey.gen.model.rdb.ForeignKeyEntry)
    117      */
    118     public void visit(ForeignKeyEntry foreignKeyEntry) {
    119         super.visit(foreignKeyEntry);
    120     }
    121
    122     /*
    123      * (non-Javadoc)
    124      *
    125      * @see org.asyrinx.joey.gen.model.rdb.RdbVisitor#visit(org.asyrinx.joey.gen.model.rdb.Index)
    126      */
    127     public void visit(Index index) {
    128         super.visit(index);
    129         for (Iterator iter = index.iterator(); iter.hasNext();) {
    130             final IndexEntry element = (IndexEntry) iter.next();
    131             visit(element);
    132         }
    133     }
    134
    135     /*
    136      * (non-Javadoc)
    137      *
    138      * @see org.asyrinx.joey.gen.model.rdb.RdbVisitor#visit(org.asyrinx.joey.gen.model.rdb.IndexEntry)
    139      */
    140     public void visit(IndexEntry indexEntry) {
    141         super.visit(indexEntry);
    142     }
    143
    144     /*
    145      * (non-Javadoc)
    146      *
    147      * @see org.asyrinx.joey.gen.model.rdb.visitor.RdbVisitorWrapper#visit(org.asyrinx.joey.gen.model.rdb.PrimaryKey)
    148      */
    149     public void visit(PrimaryKey primaryKey) {
    150         super.visit(primaryKey);
    151     }
    152
    153     /*
    154      * (non-Javadoc)
    155      *
    156      * @see org.asyrinx.joey.gen.model.rdb.RdbVisitor#visit(org.asyrinx.joey.gen.model.rdb.Table)
    157      */
    158     public void visit(Table table) {
    159         super.visit(table);
    160         for (Iterator iter = table.getColumns().iterator(); iter.hasNext();) {
    161             final Column element = (Column) iter.next();
    162             visit(element);
    163         }
    164         visit(table.getPrimaryKey());
    165         for (Iterator iter = table.getIndexes().iterator(); iter.hasNext();) {
    166             final Index element = (Index) iter.next();
    167             visit(element);
    168         }
    169         for (Iterator iter = table.getUniques().iterator(); iter.hasNext();) {
    170             final Unique element = (Unique) iter.next();
    171             visit(element);
    172         }
    173         for (Iterator iter = table.getForeignKeys().iterator(); iter.hasNext();) {
    174             final ForeignKey element = (ForeignKey) iter.next();
    175             visit(element);
    176         }
    177         for (Iterator i = table.getPatterns().iterator(); i.hasNext();) {
    178             final TablePattern pattern = (TablePattern) i.next();
    179             visit(pattern);
    180         }
    181     }
    182
    183     /*
    184      * (non-Javadoc)
    185      *
    186      * @see org.asyrinx.joey.gen.model.rdb.visitor.RdbVisitorWrapper#visit(org.asyrinx.joey.gen.model.rdb.TablePattern)
    187      */
    188     public void visit(TablePattern tablePattern) {
    189         super.visit(tablePattern);
    190         for (Iterator i = tablePattern.iterator(); i.hasNext();) {
    191             final TablePatternParam param = (TablePatternParam) i.next();
    192             visit(param);
    193         }
    194     }
    195
    196     /*
    197      * (non-Javadoc)
    198      *
    199      * @see org.asyrinx.joey.gen.model.rdb.visitor.RdbVisitorWrapper#visit(org.asyrinx.joey.gen.model.rdb.Unique)
    200      */
    201     public void visit(Unique unique) {
    202         super.visit(unique);
    203         for (Iterator iter = unique.iterator(); iter.hasNext();) {
    204             final IndexEntry element = (IndexEntry) iter.next();
    205             visit(element);
    206         }
    207     }
    208 }