KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > xquark > mapper > mapping > ColumnMapping


1 /*
2  * This file belongs to the XQuark distribution.
3  * Copyright (C) 2003 Universite de Versailles Saint-Quentin.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307.
18  * You can also get it at http://www.gnu.org/licenses/lgpl.html
19  *
20  * For more information on this software, see http://www.xquark.org.
21  */

22
23 package org.xquark.mapper.mapping;
24
25 import org.xquark.jdbc.typing.ColumnMetaData;
26 import org.xquark.mapping.Generator;
27
28 /**
29  * Interface giving access to information for mapping XML simple elements
30  * & attributes on rdbms table columns.
31  *
32  */

33 public interface ColumnMapping extends Mapping
34 {
35     /**
36      * Accessor to user column name.
37      * @return the user column name.
38      */

39     public String JavaDoc getColumnName();
40     
41     /**
42      * Accessor to the table mapping which this column mapping belongs.
43      * @return the owner table mapping.
44      */

45     public TableMapping getTableMapping();
46     
47     /**
48      * Accessor to column relational metadata.
49      * @return a ColumnMetaData object
50      */

51     public ColumnMetaData getMetaData();
52     
53     /**
54      * Returns the column index allocated during mapping file loading.
55      * @return an integer index beginning with 0 corresponding to the ordinal
56      * position of the column in JDBC user table metadata.
57      * @see TableMapping#getColumnMapping(int)
58      */

59     public int getColumnIndex();
60     
61     /**
62      * Returns the column index in the "key" columns array returned by
63      * {@link TableMapping#getPrimaryKey()}.
64      * @return the PK array index or -1 if column does not belong to "key"
65      * columns.
66      */

67     public int getKeyColumnIndex();
68     
69     /**
70      * Returns true if the column is involved in join between the OID table and
71      * the user table.
72      * @return false if the column is not involved in join or if there is no
73      * join (clustered).
74      */

75     public boolean isInJoin();
76     
77     /**
78      * Returns true if the column is to be filled with null when the element
79      * or attribute is missing.
80      * @return
81      */

82     public boolean updateColumnWhenMissing();
83     
84     /**
85      * Returns the column index in the "join" columns array returned by
86      * {@link TableMapping#getJoinColumns()}.
87      * @return the "join" array index or -1 if column does not belong to
88      * "join" columns.
89      */

90    public int getJoinColumnIndex();
91
92     /**
93      * Returns the column index in the "insert" columns array returned by {@link
94      * TableMapping#getColumnMappings()}.
95      * @return the "select" array index or -1 if column does not belong to
96      * "select" columns.
97      */

98     public int getInsertColumnIndex();
99
100     /**
101      * Returns the column index in the "select" columns array returned by
102      * {@link TableMapping#getSelectColumns()}.
103      * @return the "select" array index or -1 if column does not belong to
104      * "select" columns.
105      */

106     public int getSelectColumnIndex();
107
108     /**
109      * Returns the column index in the "fetch" columns array returned by
110      * {@link TableMapping#getFetchColumns()}.
111      * @return the "fetch" array index or -1 if column does not belong to
112      * "select" columns.
113      */

114     public int getFetchColumnIndex();
115
116     /**
117      * Returns the column index in the "update" columns array returned by
118      * {@link TableMapping#getUpdateColumns()}.
119      * @return the "update" array index or -1 if column does not belong to
120      * "update" columns.
121      */

122     public int getUpdateColumnIndex();
123     
124     /**
125      * Accessor to the MappingTypeInfo object of the column mapping which
126      * encapsulates all informations about mapping XML type on SQL type using
127      * JDBC.
128      * @return the MappingTypeInfo object associated with the colum.
129      */

130     public MappingTypeInfo getTypeInfo();
131     
132     /**
133      * Accessor to the generator object associated to this column mapping
134      * which is used to supply the data stored in the column.
135      * The generator may be a user generator or an internal generator
136      * @return an object implementing Generator
137      */

138     public Generator getGenerator();
139     
140     /**
141      * If the XML node associated to this column is optional or nullable,
142      * returns the generator that will supply the default value.
143      * @return null if no default value is needed for the column.
144      */

145     public Generator getDefaultGenerator();
146     
147     /**
148      * Return the default generator if it exists, the generator elese.
149      * @return a least a generator to call when tuple must be initialized.
150      */

151     public Generator getInitGenerator() ;
152     
153     /**
154      * Returns the index identifying the table mapping that this column mapping
155      * references (feature corresponding to rdbms foreign key).
156      * @return the reference table mapping index.
157      */

158     public int getTableRefIndex();
159     
160     /**
161      * Returns the base SQL type corresponding to the column,
162      * i.e. getMetaData().getDataType(). The base SQL types is a subset of SQL
163      * data types defined in {@link java.sql.Types} which represent a family
164      * of types. Whithin a family mainly size limits differ.
165      * @return a constant defined in {@link java.sql.Types}.
166      * @see ColumnMetaData
167      */

168     public int getColumnType();
169 }
170
Popular Tags