KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > dods > trans > Column


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: Column.java,v 1.1 2004/09/03 13:43:13 sinisa Exp $
22  */

23
24 /*
25  *
26  * @author Nenad Vico
27  * @since LBS1.8
28  * @version $Revision: 1.1 $
29  *
30  */

31 package org.enhydra.dods.trans;
32
33 /**
34  * This class represents database table column.
35  */

36 public class Column {
37     
38     /**
39      * column name
40      */

41     protected String JavaDoc name = null;
42
43     /**
44      * does column has reference
45      */

46     protected boolean is_reference = DefaultTagValues.COLUMN_IS_REFERENCE;
47
48     /**
49      * reference name
50      */

51     protected String JavaDoc ref_name = null;
52
53     /**
54      * is reference used as a constraint
55      */

56     protected boolean ref_constarint = DefaultTagValues.COLUMN_REF_CONSTARINT;
57
58     /**
59      * is reference abstarct
60      */

61     protected boolean ref_is_abstarct = DefaultTagValues.COLUMN_REF_IS_ABSTARCT;
62
63     /**
64      * is reference used as foreign key
65      */

66     protected boolean ref_is_foreign_key = DefaultTagValues.COLUMN_REF_IS_FOREIGN_KEY;
67
68     /**
69      * reference package
70      */

71     protected String JavaDoc ref_package = null;
72
73     /**
74      * reference foreign key column name
75      */

76     protected String JavaDoc ref_foreign_key_column_name = null;
77
78     /**
79      * reference foreign key group
80      */

81     protected String JavaDoc ref_foreign_key_group = null;
82
83     /**
84      * is column constant
85      */

86     protected boolean is_constant = DefaultTagValues.COLUMN_IS_CONSTANT;
87
88     /**
89      * column javadoc
90      */

91     protected String JavaDoc javadoc = null;
92
93     /**
94      * column database type
95      */

96     protected String JavaDoc db_type = DefaultTagValues.COLUMN_DB_TYPE;
97
98     /**
99      * column java type
100      */

101     protected String JavaDoc java_type = DefaultTagValues.COLUMN_JAVA_TYPE;
102
103     /**
104      * column java default value
105      */

106     protected String JavaDoc java_default_value = null;
107
108     /**
109      * is column use for query
110      */

111     protected boolean used_for_query = DefaultTagValues.COLUMN_USED_FOR_QUERY;
112
113     /**
114      * can column be null
115      */

116     protected boolean can_be_null = DefaultTagValues.COLUMN_CAN_BE_NULL;
117
118     /**
119      * is column used as primary key
120      */

121     protected boolean is_primary_key = DefaultTagValues.COLUMN_IS_PRIMARY_KEY;
122
123     /**
124      * column size
125      */

126     protected String JavaDoc size = null;
127
128     /**
129      * is column used as array
130      */

131     protected boolean is_array = DefaultTagValues.COLUMN_IS_ARRAY;
132     
133     /**
134      * This variable contains information whether the table column need security methods.
135      */

136     protected boolean is_secure = DefaultTagValues.COLUMN_SECURITY;
137
138     /**
139      * This variable contains information whether the table column need unsecurity methods.
140      */

141     protected boolean is_insecure = DefaultTagValues.COLUMN_NON_SECURITY;
142     public Column(boolean genSecure, boolean genInsecure) {
143         is_secure = genSecure;
144         is_insecure = genInsecure;
145     }
146      
147     public Column() {}
148       
149     // ------------------------- get methodes -----------------------------
150
/**
151      * Get column name.
152      *
153      * @return Column name.
154      */

155     public String JavaDoc name() {
156         return name;
157     }
158
159     /**
160      * Get the information if column has reference.
161      *
162      * @return True if column has reference.
163      */

164     public boolean isReference() {
165         return is_reference;
166     }
167
168     /**
169      * Get reference name.
170      *
171      * @return Reference name.
172      */

173     public String JavaDoc refName() {
174         return ref_name;
175     }
176
177     /**
178      * Get information if reference is used as constarint.
179      * @return True if the reference is used as constarint.
180      */

181     public boolean refConstarint() {
182         return ref_constarint;
183     }
184
185     /**
186      * Get the information if reference is abstarct
187      *
188      * @return True if the reference is abstarct
189      */

190     public boolean refIsAbstarct() {
191         return ref_is_abstarct;
192     }
193
194     /**
195      * Get the information if reference is used as foreign key.
196      *
197      * @return True if the reference is used as foreign key.
198      */

199     public boolean refIsForeignKey() {
200         return ref_is_foreign_key;
201     }
202
203     /**
204      * Get reference package.
205      *
206      *@return Reference package.
207      */

208     public String JavaDoc refPackage() {
209         return ref_package;
210     }
211
212     /**
213      * Get reference's foreign key column name
214      *
215      * @return Reference's foreign key column name.
216      */

217     public String JavaDoc refForeignKeyColumnName() {
218         return ref_foreign_key_column_name;
219     }
220
221     /**
222      * Get reference's foreign key group.
223      *
224      * @return Reference's foreign key group.
225      */

226     public String JavaDoc refForeignKeyGroup() {
227         return ref_foreign_key_group;
228     }
229
230     /**
231      * Get the information if column is constant.
232      *
233      * @return True if the column is constant.
234      */

235     public boolean isConstant() {
236         return is_constant;
237     }
238
239     /**
240      * Get column javadoc.
241      *
242      * @return Column javadoc.
243      */

244     public String JavaDoc javadoc() {
245         return javadoc;
246     }
247
248     /**
249      * Get column database type.
250      *
251      * @return Column database type.
252      */

253     public String JavaDoc dbType() {
254         return db_type;
255     }
256
257     /**
258      * Get column java type.
259      *
260      * @return Column java type.
261      */

262     public String JavaDoc javaType() {
263         return java_type;
264     }
265
266     /**
267      * Get column java default value.
268      *
269      * @return Column java default value.
270      */

271     public String JavaDoc javaDefaultValue() {
272         return java_default_value;
273     }
274
275     /**
276      * Get the information if column is used for query.
277      *
278      * @return True if the column is used for query.
279      */

280     public boolean usedForQuery() {
281         return used_for_query;
282     }
283
284     /**
285      * Get the information if column is used for query.
286      *
287      * @return True if the column is used for query.
288      */

289     public boolean canBeNull() {
290         return can_be_null;
291     }
292
293     /**
294      * Get the information if column is used as primary key.
295      *
296      * @return True if the column is used as primary key.
297      */

298     public boolean isPrimaryKey() {
299         return is_primary_key;
300     }
301
302     /**
303      * Get column size.
304      *
305      * @return Column size.
306      */

307     public String JavaDoc size() {
308         return size;
309     }
310
311     /**
312      * Get the information if column is used as array.
313      *
314      * @return True if the column is used as array.
315      */

316     public boolean isArray() {
317         return is_array;
318     }
319
320     /**
321      * Get the information whether DO has security methods.
322      *
323      * @return True if DO is security based, otherwise false.
324      */

325     public boolean isSecure() {
326         return is_secure;
327     }
328
329     /**
330      * Get the information whether DO has security methods.
331      *
332      * @return True if DO is unsecurity based, otherwise false.
333      */

334     public boolean isInSecure() {
335         return is_insecure;
336     }
337
338     // ------------------------- set methodes -----------------------------
339
/**
340      * Set column name.
341      *
342      * @param name Column name.
343      */

344     public void name(String JavaDoc name) {
345         this.name = name;
346     }
347
348     /**
349      * Set reference name.
350      * @param ref_name Reference name.
351      */

352     public void refName(String JavaDoc ref_name) {
353         this.ref_name = ref_name;
354         this.is_reference = true;
355     }
356
357     /**
358      * Set reference to/not to be used as constarint.
359      *
360      * @param ref_constarint True if the reference is use as constarint, otherwise false.
361      */

362     public void refConstarint(boolean ref_constarint) {
363         this.ref_constarint = ref_constarint;
364     }
365
366     /**
367      * reference to/not to be abstarct.
368      *
369      * @param ref_is_abstarct True if the reference is abstarct, otherwise false.
370      */

371     public void refIsAbstarct(boolean ref_is_abstarct) {
372         this.ref_is_abstarct = ref_is_abstarct;
373     }
374
375     /**
376      * Set reference to/not to be used as foreign key.
377      *
378      * @param ref_is_foreign_key True if the reference is used as foreign key, otherwise false.
379      */

380     public void refIsForeignKey(boolean ref_is_foreign_key) {
381         this.ref_is_foreign_key = ref_is_foreign_key;
382     }
383
384     /**
385      * Set reference package.
386      *
387      * @param ref_package Reference package.
388      */

389     public void refPackage(String JavaDoc ref_package) {
390         this.ref_package = ref_package;
391     }
392
393     /**
394      * Set reference's foreign key column name.
395      *
396      * @param ref_foreign_key_column_name Reference's foreign key column name.
397      */

398     public void refForeignKeyColumnName(String JavaDoc ref_foreign_key_column_name) {
399         this.ref_foreign_key_column_name = ref_foreign_key_column_name;
400     }
401
402     /**
403      * Set reference's foreign key group.
404      *
405      * @param ref_foreign_key_group Reference's foreign key group.
406      */

407     public void refForeignKeyGroup(String JavaDoc ref_foreign_key_group) {
408         this.ref_foreign_key_group = ref_foreign_key_group;
409     }
410
411     /**
412      * Set column to/not to be constant.
413      *
414      * @param is_constant True if the column is constant, otherwise false.
415      */

416     public void isConstant(boolean is_constant) {
417         this.is_constant = is_constant;
418     }
419
420     /**
421      * Set column javadoc.
422      *
423      * @param javadoc Column javadoc.
424      */

425     public void javadoc(String JavaDoc javadoc) {
426         this.javadoc = javadoc;
427     }
428
429     /**
430      * Set column database type.
431      *
432      * @param db_type Column database type.
433      */

434     public void dbType(String JavaDoc db_type) {
435         this.db_type = db_type;
436     }
437
438     /**
439      * Set column java type.
440      *
441      * @param java_type Column java type.
442      */

443     public void javaType(String JavaDoc java_type) {
444         this.java_type = java_type;
445     }
446
447     /**
448      * Set column java default value.
449      *
450      * @param java_default_value Column java default value.
451      */

452     public void javaDefaultValue(String JavaDoc java_default_value) {
453         this.java_default_value = java_default_value;
454     }
455
456     /**
457      * Set column to/not to be used for query.
458      *
459      * @param used_for_query True if the column is used for query, otherwise false.
460      */

461     public void usedForQuery(boolean used_for_query) {
462         this.used_for_query = used_for_query;
463     }
464
465     /**
466      * Set column to/not to be able to be null.
467      *
468      * @param can_be_null True if the column can be null, otherwise false.
469      */

470     public void canBeNull(boolean can_be_null) {
471         this.can_be_null = can_be_null;
472     }
473     
474     /**
475      * Set column to/not to be used as primary key.
476      *
477      * @param is_primary_key True if the column is used as primary key, otherwise false.
478      */

479     public void isPrimaryKey(boolean is_primary_key) {
480         this.is_primary_key = is_primary_key;
481     }
482
483     /**
484      * Set column size.
485      *
486      * @param size Column size.
487      */

488     public void size(String JavaDoc size) {
489         this.size = size;
490     }
491
492     /**
493      * Set column to/not to be used as array.
494      *
495      * @param is_array True if the column is used as array, otherwise false.
496      */

497     public void isArray(boolean is_array) {
498         this.is_array = is_array;
499     }
500
501     /**
502      * Set DO to/not to have security methods.
503      *
504      * @param is_secure True if DO need security methods, otherwise false.
505      */

506     public void isSecure(boolean is_secure) {
507         this.is_secure = is_secure;
508     }
509
510     /**
511      * Set DO to/not to have security methods.
512      *
513      * @param is_Insecure True if DO need unsecurity methods, otherwise false.
514      */

515     public void isInSecure(boolean is_Insecure) {
516         this.is_insecure = is_Insecure;
517     }
518
519     /**
520      * Get String representation.
521      *
522      * return String presentation.
523      */

524     public String JavaDoc toString() {
525         StringBuffer JavaDoc ret = new StringBuffer JavaDoc("name=").append(name).append(" is_reference=").append(is_reference).append(" ref_name=").append(ref_name);
526
527         ret.append(" ref_constarint=").append(ref_constarint).append(" ref_is_abstarct=").append(ref_is_abstarct);
528         ret.append(" ref_is_foreign_key=").append(ref_is_foreign_key).append(" ref_package=").append(ref_package);
529         ret.append(" ref_foreign_key_column_name=").append(ref_foreign_key_column_name).append(" ref_foreign_key_group=").append(ref_foreign_key_group);
530         ret.append(" is_constant=").append(is_constant).append(" javadoc=").append(javadoc);
531         ret.append(" db_type=").append(db_type).append(" java_type=").append(java_type);
532         ret.append(" java_default_value=").append(java_default_value).append(" used_for_query=").append(used_for_query);
533         ret.append(" can_be_null=").append(can_be_null).append(" is_primary_key=").append(is_primary_key);
534         ret.append(" size=").append(size).append(" is_array=").append(is_array);
535         return ret.toString();
536     }
537
538     public static void main(String JavaDoc[] args) {
539         Column column = new Column();
540
541         System.out.println("Column: \n" + column);
542     }
543 }
544
Popular Tags