View Javadoc

1   package com.explosion.expfmodules.rdbmsconn.dbom;
2   
3   import java.util.Iterator;
4   import java.util.List;
5   
6   
7   
8   /* =============================================================================
9    *       
10   *     Copyright 2004 Stephen Cowx
11   *
12   *     Licensed under the Apache License, Version 2.0 (the "License");
13   *     you may not use this file except in compliance with the License.
14   *     You may obtain a copy of the License at
15   *
16   *     http://www.apache.org/licenses/LICENSE-2.0
17   *
18   *     Unless required by applicable law or agreed to in writing, software
19   *     distributed under the License is distributed on an "AS IS" BASIS,
20   *     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21   *     See the License for the specific language governing permissions and
22   *     limitations under the License.
23   * 
24   * =============================================================================
25   */
26  
27  /***
28   * This class contains the sum total of all the information known about a particular entity
29   * 
30   * @author Stephen
31   * Created on May 1, 2004
32   */
33  public class EntityMetaData
34  {
35      private DBEntity dbEntity;
36      private DataSet dataSet;
37      /***
38       * @return Returns the dbEntity.
39       */
40      public DBEntity getDbEntity()
41      {
42          return dbEntity;
43      }
44      /***
45       * @param dbEntity The dbEntity to dataSet.
46       */
47      public void setDbEntity(DBEntity dbed)
48      {
49          this.dbEntity = dbed;
50      }
51      /***
52       * @return Returns the dataSet.
53       */
54      public DataSet getDataSet()
55      {
56          return dataSet;
57      }
58      /***
59       * @param dataSet The dataSet to dataSet.
60       */
61      public void setDataSet(DataSet set)
62      {
63          this.dataSet = set;
64      }
65      
66      /***
67       * Sadly, the column information in JDBC is available from
68       * two very different places.  This method merges the column data
69       * available into one place, namely, the DBColumn ojects
70       * so that I don;t have to carry two around with me wherever I go
71       *
72       */
73      public void mergeColumnDataIntoDBColumns()
74      {
75          List columns = dbEntity.getColumns();
76          for (Iterator i = columns.iterator(); i.hasNext();)
77          {
78          	DBEntityColumn column = (DBEntityColumn) i.next();
79          	DataSetColumn col = dataSet.getColumn(column.getColumnName());
80          	
81          	if (col != null && column != null)
82          	{
83                 column.setAutoIncrement(col.isAutoIncrement());
84                 column.setCaseSensitive(col.isCaseSensitive());
85                 column.setCurrency(col.isCurrency());
86                 column.setDefinitelyWritable(col.isDefinitelyWritable());
87                 column.setReadOnly(col.isReadOnly());
88                 column.setSearchable(col.isSearchable());
89                 column.setSigned(col.isSigned());
90                 column.setWritable(col.isWritable());
91          	}
92          	
93          }
94      }
95  }