26
26
import schemacrawler .schema .Column ;
27
27
import schemacrawler .schema .ColumnReference ;
28
28
import schemacrawler .schema .CrawlInfo ;
29
+ import schemacrawler .schema .DatabaseObject ;
30
+ import schemacrawler .schema .Function ;
29
31
import schemacrawler .schema .Index ;
30
32
import schemacrawler .schema .IndexColumn ;
31
33
import schemacrawler .schema .JavaSqlTypeGroup ;
32
34
import schemacrawler .schema .PartialDatabaseObject ;
35
+ import schemacrawler .schema .Procedure ;
33
36
import schemacrawler .schema .Routine ;
34
37
import schemacrawler .schema .Schema ;
35
38
import schemacrawler .schema .Sequence ;
39
42
import schemacrawler .schema .TableConstraintColumn ;
40
43
import schemacrawler .schema .TableReference ;
41
44
import schemacrawler .schema .TableRelationshipType ;
45
+ import schemacrawler .schema .View ;
42
46
import schemacrawler .schemacrawler .Identifiers ;
43
47
import schemacrawler .schemacrawler .SchemaCrawlerOptions ;
44
48
import us .fatehi .utility .UtilityMarker ;
@@ -64,6 +68,16 @@ public String toString() {
64
68
}
65
69
}
66
70
71
+ public enum SimpleDatabaseObjectType {
72
+ unknown ,
73
+ table ,
74
+ view ,
75
+ procedure ,
76
+ function ,
77
+ synonym ,
78
+ sequence ;
79
+ }
80
+
67
81
public static Collection <List <String >> allIndexCoumnNames (final Table table ) {
68
82
return indexCoumnNames (table , false );
69
83
}
@@ -195,6 +209,30 @@ public static String getColumnsListAsString(
195
209
return joinColumns (columns , false , identifiers );
196
210
}
197
211
212
+ public static SimpleDatabaseObjectType getSimpleTypeName (final DatabaseObject databaseObject ) {
213
+ if (databaseObject == null ) {}
214
+ if (databaseObject instanceof Synonym ) {
215
+ return SimpleDatabaseObjectType .synonym ;
216
+ }
217
+ if (databaseObject instanceof Sequence ) {
218
+ return SimpleDatabaseObjectType .sequence ;
219
+ }
220
+ if (databaseObject instanceof Function ) {
221
+ return SimpleDatabaseObjectType .function ;
222
+ }
223
+ if (databaseObject instanceof Procedure ) {
224
+ return SimpleDatabaseObjectType .procedure ;
225
+ }
226
+ // NOTE: Check View before Table, since View is a subclass of Table
227
+ if (databaseObject instanceof View ) {
228
+ return SimpleDatabaseObjectType .view ;
229
+ }
230
+ if (databaseObject instanceof Table ) {
231
+ return SimpleDatabaseObjectType .table ;
232
+ }
233
+ return SimpleDatabaseObjectType .unknown ;
234
+ }
235
+
198
236
public static boolean isForeignKeyUnique (final TableReference tableRef ) {
199
237
if (tableRef == null ) {
200
238
return false ;
@@ -221,9 +259,9 @@ public static String joinColumns(
221
259
}
222
260
final JavaSqlTypeGroup javaSqlTypeGroup =
223
261
column .getColumnDataType ().getJavaSqlType ().getJavaSqlTypeGroup ();
224
- if (( !omitLargeObjectColumns
225
- || (( javaSqlTypeGroup != JavaSqlTypeGroup .large_object )
226
- && ( javaSqlTypeGroup != JavaSqlTypeGroup .object ))) ) {
262
+ if (!omitLargeObjectColumns
263
+ || javaSqlTypeGroup != JavaSqlTypeGroup .large_object
264
+ && javaSqlTypeGroup != JavaSqlTypeGroup .object ) {
227
265
columnsList .add (identifiers .quoteName (column .getName ()));
228
266
}
229
267
}
0 commit comments