30
30
import com .netflix .metacat .main .manager .ConnectorManager ;
31
31
import com .netflix .metacat .main .services .CatalogService ;
32
32
import com .netflix .metacat .common .server .spi .MetacatCatalogConfig ;
33
+ import com .netflix .metacat .main .services .GetCatalogServiceParameters ;
33
34
34
35
import javax .annotation .Nonnull ;
35
36
import java .util .List ;
@@ -70,7 +71,7 @@ public CatalogServiceImpl(
70
71
*/
71
72
@ Nonnull
72
73
@ Override
73
- public CatalogDto get (final QualifiedName name ) {
74
+ public CatalogDto get (final QualifiedName name , final GetCatalogServiceParameters getCatalogServiceParameters ) {
74
75
final Set <MetacatCatalogConfig > configs = connectorManager .getCatalogConfigs (name .getCatalogName ());
75
76
final CatalogDto result = new CatalogDto ();
76
77
result .setName (name );
@@ -83,20 +84,34 @@ public CatalogDto get(final QualifiedName name) {
83
84
} else {
84
85
qName = QualifiedName .ofDatabase (name .getCatalogName (), config .getSchemaWhitelist ().get (0 ));
85
86
}
86
- databases .addAll (
87
- connectorManager .getDatabaseService (qName ).listNames (context , name , null , null , null )
88
- .stream ().map (QualifiedName ::getDatabaseName )
89
- .filter (s -> config .getSchemaBlacklist ().isEmpty () || !config .getSchemaBlacklist ().contains (s ))
90
- .filter (s -> config .getSchemaWhitelist ().isEmpty () || config .getSchemaWhitelist ().contains (s ))
91
- .sorted (String .CASE_INSENSITIVE_ORDER )
92
- .collect (Collectors .toList ())
93
- );
87
+ if (getCatalogServiceParameters .isIncludeDatabaseNames ()) {
88
+ databases .addAll (
89
+ connectorManager .getDatabaseService (qName ).listNames (context , name , null , null , null )
90
+ .stream ().map (QualifiedName ::getDatabaseName )
91
+ .filter (s -> config .getSchemaBlacklist ().isEmpty () || !config .getSchemaBlacklist ().contains (s ))
92
+ .filter (s -> config .getSchemaWhitelist ().isEmpty () || config .getSchemaWhitelist ().contains (s ))
93
+ .sorted (String .CASE_INSENSITIVE_ORDER )
94
+ .collect (Collectors .toList ())
95
+ );
96
+ }
94
97
});
95
98
result .setDatabases (databases );
96
- userMetadataService .populateMetadata (result , false );
99
+ if (getCatalogServiceParameters .isIncludeUserMetadata ()) {
100
+ userMetadataService .populateMetadata (result , false );
101
+ }
97
102
return result ;
98
103
}
99
104
105
+ /**
106
+ * {@inheritDoc}
107
+ */
108
+ @ Nonnull
109
+ @ Override
110
+ public CatalogDto get (final QualifiedName name ) {
111
+ return get (name , GetCatalogServiceParameters .builder ().includeDatabaseNames (true )
112
+ .includeUserMetadata (true ).build ());
113
+ }
114
+
100
115
/**
101
116
* {@inheritDoc}
102
117
*/
0 commit comments