本文整理汇总了Java中org.apache.metamodel.schema.Schema.getTableCount方法的典型用法代码示例。如果您正苦于以下问题:Java Schema.getTableCount方法的具体用法?Java Schema.getTableCount怎么用?Java Schema.getTableCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.metamodel.schema.Schema
的用法示例。
在下文中一共展示了Schema.getTableCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPreviewTable
import org.apache.metamodel.schema.Schema; //导入方法依赖的package包/类
protected Table getPreviewTable(final DataContext dc) {
final Schema schema = dc.getDefaultSchema();
if (schema.getTableCount() == 0) {
return null;
}
return schema.getTable(0);
}
示例2: setSchemaTree
import org.apache.metamodel.schema.Schema; //导入方法依赖的package包/类
private void setSchemaTree(final Datastore datastore, final boolean expandTree, final DatastoreConnection con) {
if (con != null) {
final Schema defaultSchema = con.getSchemaNavigator().getDefaultSchema();
final int datastoreSize = defaultSchema.getTableCount();
if (datastoreSize == 1) {
_schemaTreePanel.setDatastore(datastore, true);
} else {
_schemaTreePanel.setDatastore(datastore, expandTree);
}
}
}
示例3: addTableToSource
import org.apache.metamodel.schema.Schema; //导入方法依赖的package包/类
private void addTableToSource(final DatastoreConnection con) {
if (con != null) {
final Schema defaultSchema = con.getSchemaNavigator().getDefaultSchema();
final int datastoreSize = defaultSchema.getTableCount();
if (datastoreSize == 1) {
final List<Column> columns = defaultSchema.getTable(0).getColumns();
_analysisJobBuilder.addSourceColumns(columns);
}
}
}
示例4: convertToTable
import org.apache.metamodel.schema.Schema; //导入方法依赖的package包/类
public Table convertToTable(String schemaName, String tableName) {
final Schema schema;
if (schemaName == null) {
schema = getDefaultSchema();
} else {
schema = getSchemaByName(schemaName);
}
if (schema == null) {
throw new IllegalArgumentException("Schema " + schemaName + " not found. Available schema names are: "
+ Arrays.toString(dataContext.getSchemaNames()));
}
final Table table;
if (tableName == null) {
if (schema.getTableCount() == 1) {
table = schema.getTables()[0];
} else {
throw new IllegalArgumentException(
"No table name specified, and multiple options exist. Available table names are: "
+ Arrays.toString(schema.getTableNames()));
}
} else {
table = schema.getTableByName(tableName);
}
if (table == null) {
throw new IllegalArgumentException("Table not found. Available table names are: "
+ Arrays.toString(schema.getTableNames()));
}
return table;
}
示例5: getColumnPathQualification
import org.apache.metamodel.schema.Schema; //导入方法依赖的package包/类
private String getColumnPathQualification(Datastore datastore, Collection<InputColumn<?>> sourceColumns) {
if (datastore == null || sourceColumns == null || sourceColumns.isEmpty()) {
return COLUMN_PATH_QUALIFICATION_FULL;
}
try (DatastoreConnection connection = datastore.openConnection()) {
SchemaNavigator schemaNavigator = connection.getSchemaNavigator();
Schema[] schemas = schemaNavigator.getSchemas();
Schema singleSchema = null;
int realSchemas = 0;
for (Schema schema : schemas) {
if (!MetaModelHelper.isInformationSchema(schema)) {
realSchemas++;
singleSchema = schema;
}
}
if (realSchemas == 1) {
if (singleSchema.getTableCount() == 1) {
return COLUMN_PATH_QUALIFICATION_COLUMN;
}
return COLUMN_PATH_QUALIFICATION_TABLE;
}
return COLUMN_PATH_QUALIFICATION_FULL;
}
}
示例6: getDefaultSchema
import org.apache.metamodel.schema.Schema; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public final Schema getDefaultSchema() throws MetaModelException {
Schema result = null;
final String defaultSchemaName = getDefaultSchemaName();
if (defaultSchemaName != null) {
result = getSchemaByName(defaultSchemaName);
}
if (result == null) {
final List<Schema> schemas = getSchemas();
if (schemas.size() == 1) {
result = schemas.get(0);
} else {
int highestTableCount = -1;
for (Schema schema : schemas) {
String name = schema.getName();
if (schema != null) {
name = name.toLowerCase();
final boolean isInformationSchema = name.startsWith("information") && name.endsWith("schema");
if (!isInformationSchema && schema.getTableCount() > highestTableCount) {
highestTableCount = schema.getTableCount();
result = schema;
}
}
}
}
}
return result;
}