org.apache.metamodel.schema.Table类的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(325)

本文整理了Java中org.apache.metamodel.schema.Table类的一些代码示例,展示了Table类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table类的具体详情如下:
包路径:org.apache.metamodel.schema.Table
类名称:Table

Table介绍

[英]Represents a table and it's metadata description. Tables reside within a schema and contains columns and relationships to other tables.
[中]表示表及其元数据描述。表位于架构中,包含列以及与其他表的关系。

代码示例

代码示例来源:origin: datacleaner/DataCleaner

  1. private static String getTablePostFix(final Table table) {
  2. final String postFix;
  3. final Schema schema = table.getSchema();
  4. if (schema == null) {
  5. postFix = "." + table.getName();
  6. } else {
  7. postFix = "." + schema.getName() + "." + table.getName();
  8. }
  9. return postFix;
  10. }

代码示例来源:origin: apache/metamodel

  1. @Override
  2. public List<Column> getColumns() {
  3. return aliasedTable.getColumns();
  4. }

代码示例来源:origin: org.apache.metamodel/MetaModel-core

  1. @Override
  2. public FilterBuilder<RowUpdationBuilder> where(String columnName) {
  3. Column column = _table.getColumnByName(columnName);
  4. if (column == null) {
  5. throw new IllegalArgumentException("No such column: " + columnName);
  6. }
  7. return where(column);
  8. }

代码示例来源:origin: org.apache.metamodel/MetaModel-core

  1. protected ImmutableTable(Table table, ImmutableSchema schema) {
  2. this(table.getName(), table.getType(), schema, table.getRemarks(),
  3. table.getQuote());
  4. List<Column> origColumns = table.getColumns();
  5. for (Column column : origColumns) {
  6. columns.add(new ImmutableColumn(column, this));
  7. }
  8. }

代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc

  1. public Schema toSerializableForm() {
  2. for (Table table : getTables()) {
  3. table.getColumns();
  4. table.getIndexedColumns();
  5. table.getPrimaryKeys();
  6. }
  7. loadRelations();
  8. return this;
  9. }

代码示例来源:origin: datacleaner/DataCleaner

  1. @Override
  2. protected String getBannerTitle() {
  3. return "Save " + _table.getName() + "\nas Excel spreadsheet file";
  4. }
  5. };

代码示例来源:origin: org.apache.metamodel/MetaModel-jdbc

  1. private void loadIndexes(Table table, DatabaseMetaData metaData) throws MetaModelException {
  2. Schema schema = table.getSchema();
  3. // Ticket #170: IndexInfo is nice-to-have, not need-to-have, so
  4. // we will do a nice failover on SQLExceptions
  5. try (ResultSet rs = metaData.getIndexInfo(getCatalogName(schema), getJdbcSchemaName(schema), table.getName(),
  6. false, true)) {
  7. while (rs.next()) {
  8. String columnName = rs.getString(9);
  9. if (columnName != null) {
  10. MutableColumn column = (MutableColumn) table.getColumnByName(columnName);
  11. if (column != null) {
  12. column.setIndexed(true);
  13. } else {
  14. logger.error("Indexed column \"{}\" could not be found in table: {}", columnName, table);
  15. }
  16. }
  17. }
  18. } catch (SQLException e) {
  19. throw JdbcUtils.wrapException(e, "retrieve index information for " + table.getName(), JdbcActionType.METADATA);
  20. }
  21. }

代码示例来源:origin: org.eobjects.analyzerbeans/AnalyzerBeans-core

  1. Column[] primaryKeyColumns = _table.getPrimaryKeys();
  2. if (primaryKeyColumns == null || primaryKeyColumns.length == 0) {
  3. logger.info("No primary keys defined for table {}, not pre-selecting primary keys", _table.getName());
  4. return;

代码示例来源:origin: datacleaner/DataCleaner

  1. private SimpleTableDef createTableDef(final Table table) {
  2. final int columnCount = table.getColumnCount();
  3. final String[] names = new String[columnCount];
  4. final ColumnType[] types = new ColumnType[columnCount];
  5. for (int i = 0; i < columnCount; i++) {
  6. names[i] = table.getColumn(i).getName();
  7. types[i] = table.getColumn(i).getType();
  8. }
  9. return new SimpleTableDef(table.getName(), names, types);
  10. }

代码示例来源:origin: apache/metamodel

  1. protected boolean isMainSchemaTable(Table table) {
  2. Schema schema = table.getSchema();
  3. if (INFORMATION_SCHEMA_NAME.equals(schema.getName())) {
  4. return false;
  5. } else {
  6. return true;
  7. }
  8. }

代码示例来源:origin: datacleaner/DataCleaner

  1. @Override
  2. protected void writeHeader(final Writer writer) throws IOException {
  3. final List<String> headers = new ArrayList<>(table.getColumnNames());
  4. if (!_isColumnToBeSortedOnPresentInInput) {
  5. headers.remove(columnToBeSortedOn.getName());
  6. }
  7. final String[] columnNames = headers.toArray(new String[0]);
  8. final String line = csvWriter.buildLine(columnNames);
  9. writer.write(line);
  10. }

代码示例来源:origin: org.eobjects.analyzerbeans/AnalyzerBeans-core

  1. @Override
  2. public TableMetadata getTableMetadata(Table table) {
  3. if (table == null) {
  4. return null;
  5. }
  6. final String tableName = table.getName();
  7. return getTableMetadataByName(tableName);
  8. }

代码示例来源:origin: apache/metamodel

  1. protected ImmutableTable(Table table, ImmutableSchema schema) {
  2. this(table.getName(), table.getType(), schema, table.getRemarks(),
  3. table.getQuote());
  4. List<Column> origColumns = table.getColumns();
  5. for (Column column : origColumns) {
  6. columns.add(new ImmutableColumn(column, this));
  7. }
  8. }

代码示例来源:origin: apache/metamodel

  1. private void loadIndexes(Table table, DatabaseMetaData metaData) throws MetaModelException {
  2. Schema schema = table.getSchema();
  3. // Ticket #170: IndexInfo is nice-to-have, not need-to-have, so
  4. // we will do a nice failover on SQLExceptions
  5. try (ResultSet rs = metaData.getIndexInfo(getCatalogName(schema), getJdbcSchemaName(schema), table.getName(),
  6. false, true)) {
  7. while (rs.next()) {
  8. String columnName = rs.getString(9);
  9. if (columnName != null) {
  10. MutableColumn column = (MutableColumn) table.getColumnByName(columnName);
  11. if (column != null) {
  12. column.setIndexed(true);
  13. } else {
  14. logger.error("Indexed column \"{}\" could not be found in table: {}", columnName, table);
  15. }
  16. }
  17. }
  18. } catch (SQLException e) {
  19. throw JdbcUtils.wrapException(e, "retrieve index information for " + table.getName(), JdbcActionType.METADATA);
  20. }
  21. }

代码示例来源:origin: datacleaner/DataCleaner

  1. /**
  2. * Inspects the row processed tables primary keys. If all primary keys are
  3. * in the source columns of the AnalysisJob, they will be added to the
  4. * physically queried columns.
  5. *
  6. * Adding the primary keys to the query is a trade-off: It helps a lot in
  7. * making eg. annotated rows referenceable to the source table, but it may
  8. * also potentially make the job heavier to execute since a lot of (unique)
  9. * values will be retrieved.
  10. */
  11. public void addPrimaryKeysIfSourced() {
  12. final List<Column> primaryKeyColumns = getTable().getPrimaryKeys();
  13. if (primaryKeyColumns == null || primaryKeyColumns.isEmpty()) {
  14. logger.info("No primary keys defined for table {}, not pre-selecting primary keys", getTable().getName());
  15. return;
  16. }
  17. final Collection<InputColumn<?>> sourceInputColumns = getAnalysisJob().getSourceColumns();
  18. final List<Column> sourceColumns = CollectionUtils.map(sourceInputColumns, InputColumn::getPhysicalColumn);
  19. for (final Column primaryKeyColumn : primaryKeyColumns) {
  20. if (!sourceColumns.contains(primaryKeyColumn)) {
  21. logger.info("Primary key column {} not added to source columns, not pre-selecting primary keys");
  22. return;
  23. }
  24. }
  25. addPhysicalColumns(primaryKeyColumns);
  26. }

代码示例来源:origin: org.apache.metamodel/MetaModel-core

  1. protected boolean isMainSchemaTable(Table table) {
  2. Schema schema = table.getSchema();
  3. if (INFORMATION_SCHEMA_NAME.equals(schema.getName())) {
  4. return false;
  5. } else {
  6. return true;
  7. }
  8. }

代码示例来源:origin: apache/metamodel

  1. public Schema toSerializableForm() {
  2. for (Table table : getTables()) {
  3. table.getColumns();
  4. table.getIndexedColumns();
  5. table.getPrimaryKeys();
  6. }
  7. loadRelations();
  8. return this;
  9. }

代码示例来源:origin: datacleaner/DataCleaner

  1. @Override
  2. protected void writeHeader(final ExcelDataContextWriter writer) throws IOException {
  3. final List<String> headers = new ArrayList<>(table.getColumnNames());
  4. if (!isColumnToBeSortedOnPresentInInput) {
  5. headers.remove(columnToBeSortedOn.getName());
  6. }
  7. writer.createTable(headers);
  8. }

代码示例来源:origin: org.apache.metamodel/MetaModel-core

  1. public DropTable(Table table) {
  2. this(table.getSchema().getName(), table.getName());
  3. }

代码示例来源:origin: datacleaner/DataCleaner

  1. @Override
  2. public String toString() {
  3. return getTable().getName();
  4. }
  5. }

相关文章