本文整理汇总了Java中org.apache.metamodel.schema.Table类的典型用法代码示例。如果您正苦于以下问题:Java Table类的具体用法?Java Table怎么用?Java Table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Table类属于org.apache.metamodel.schema包,在下文中一共展示了Table类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public QueryResponse get(@PathVariable("tenant") String tenantId,
@PathVariable("dataContext") String dataSourceName, @PathVariable("schema") String schemaId,
@PathVariable("table") String tableId, @RequestParam(value = "offset", required = false) Integer offset,
@RequestParam(value = "limit", required = false) Integer limit) {
final TenantContext tenantContext = tenantRegistry.getTenantContext(tenantId);
final DataContext dataContext = tenantContext.getDataSourceRegistry().openDataContext(dataSourceName);
final DataContextTraverser traverser = new DataContextTraverser(dataContext);
final Table table = traverser.getTable(schemaId, tableId);
final Query query = dataContext.query().from(table).selectAll().toQuery();
return QueryController.executeQuery(tenantContext, dataSourceName, dataContext, query, offset, limit);
}
示例2: createWriter
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
public static Writer createWriter(Project project, List<Table> tables){
Writer writer = null;
String framework = project.getFramework();
switch(framework){
case "spark":
writer = new SparkWriter(project, tables);
break;
case "nethttp":
writer = new NetHttpWriter(project, tables);
break;
case "express":
writer = new ExpressWriter(project, tables);
default:
throw new FrameworkNotSupportedExecption("Writer Factory Error: Code writer for "+ framework+" is not supported yet.");
}
return writer;
}
示例3: updateColumnsOfTable
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
private void updateColumnsOfTable(Table rawTable, MTable mTable) throws MetaException {
Map<String, MColumn> oldColumns = new HashMap<>();
for (MetaColumn col : mTable.getColumns())
oldColumns.put(col.getName(), (MColumn) col);
Set<String> oldColumnNames = new TreeSet<>(oldColumns.keySet());
Set<String> newColumnNames = new TreeSet<>();
for (Column rawColumn : getRawTableColumns(rawTable)) {
String colName = rawColumn.getName();
newColumnNames.add(colName);
/* NOTE: column order could be wrong! */
if (!oldColumns.containsKey(colName))
addColumn(rawColumn, mTable);
}
// remove old columns
oldColumnNames.removeAll(newColumnNames);
for (String name : oldColumnNames)
pm.deletePersistent(oldColumns.get(name));
}
示例4: configureForTransformedData
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
@Override
public void configureForTransformedData(final AnalysisJobBuilder analysisJobBuilder,
final TransformerDescriptor<?> descriptor) {
final List<Table> tables = analysisJobBuilder.getSourceTables();
if (tables.size() == 1) {
final List<MetaModelInputColumn> sourceColumns = analysisJobBuilder.getSourceColumnsOfTable(tables.get(0));
final List<InputColumn<?>> primaryKeys = new ArrayList<>();
for (final MetaModelInputColumn inputColumn : sourceColumns) {
if (inputColumn.getPhysicalColumn().isPrimaryKey()) {
primaryKeys.add(inputColumn);
}
}
if (!primaryKeys.isEmpty()) {
conditionValues = primaryKeys.toArray(new InputColumn[primaryKeys.size()]);
}
}
}
示例5: createComboBox
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
private SourceColumnComboBox createComboBox(final InputColumn<?> inputColumn, Column mappedColumn) {
final SourceColumnComboBox sourceColumnComboBox = new SourceColumnComboBox();
_mappedColumnComboBoxes.put(inputColumn, sourceColumnComboBox);
final Table table = _tableRef.get();
if (mappedColumn == null && table != null) {
mappedColumn = getDefaultMappedColumn(inputColumn, table);
}
if (mappedColumn == null) {
logger.info("No default mapping found for column: {}", inputColumn);
} else {
sourceColumnComboBox.setEditable(true);
sourceColumnComboBox.setSelectedItem(mappedColumn);
sourceColumnComboBox.setEditable(false);
}
sourceColumnComboBox.addColumnSelectedListener(item -> {
if (isBatchUpdating()) {
return;
}
_mappedColumnNamesPropertyWidget.fireValueChanged();
fireValueChanged();
});
return sourceColumnComboBox;
}
示例6: showTableConfigurationDialog
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
public void showTableConfigurationDialog(final Table table) {
final SourceTableConfigurationDialog existingDialog = _tableConfigurationDialogs.get(table);
if (existingDialog != null) {
existingDialog.toFront();
return;
}
final AnalysisJobBuilder analysisJobBuilder = _graphContext.getAnalysisJobBuilder(table);
final SourceTableConfigurationDialog dialog =
new SourceTableConfigurationDialog(_windowContext, analysisJobBuilder, table);
dialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(final WindowEvent e) {
_tableConfigurationDialogs.remove(table);
}
});
_tableConfigurationDialogs.put(table, dialog);
dialog.open();
}
示例7: getLocalInputColumns
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
private InputColumn<?>[] getLocalInputColumns(final SourceColumnFinder sourceColumnFinder, final Table table,
final InputColumn<?>[] inputColumns) {
if (table == null || inputColumns == null || inputColumns.length == 0) {
return new InputColumn<?>[0];
}
final List<InputColumn<?>> result = new ArrayList<>();
for (final InputColumn<?> inputColumn : inputColumns) {
final Set<Column> sourcePhysicalColumns = sourceColumnFinder.findOriginatingColumns(inputColumn);
for (final Column physicalColumn : sourcePhysicalColumns) {
if (table.equals(physicalColumn.getTable())) {
result.add(inputColumn);
break;
}
}
}
return result.toArray(new InputColumn<?>[result.size()]);
}
示例8: findOriginatingTable
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
private Table findOriginatingTable(InputColumn<?> inputColumn, Set<Object> resolvedSet) {
if (!resolvedSet.add(inputColumn)) {
logger.debug(LOG_MESSAGE_RECURSIVE_TRAVERSAL);
return null;
}
if (inputColumn == null) {
logger.warn("InputColumn was null, no originating table found");
return null;
}
if (inputColumn.isPhysicalColumn()) {
return inputColumn.getPhysicalColumn().getTable();
}
final InputColumnSourceJob inputColumnSource = findInputColumnSource(inputColumn);
if (!resolvedSet.add(inputColumnSource)) {
logger.debug(LOG_MESSAGE_RECURSIVE_TRAVERSAL);
return null;
}
return findOriginatingTableOfSource(inputColumnSource, resolvedSet);
}
示例9: registerEnterConfigurationAction
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
private void registerEnterConfigurationAction() {
registerAction(KEY_ENTER, KeyStroke.getKeyStroke(KEY_ENTER), new JobGraphBindingAction() {
@Override
public void actionPerformed(final ActionEvent e) {
final Set<Object> vertices = _graphContext.getSelectedVertices();
if (vertices.size() != 1) {
return;
}
final Object vertex = vertices.iterator().next();
if (vertex instanceof ComponentBuilder) {
final ComponentBuilder componentBuilder = (ComponentBuilder) vertex;
_actions.showConfigurationDialog(componentBuilder);
} else if (vertex instanceof Table) {
final Table table = (Table) vertex;
_actions.showTableConfigurationDialog(table);
}
}
});
}
示例10: getMainSchema
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
@Override
protected Schema getMainSchema() throws MetaModelException {
return new AbstractSchema() {
private static final long serialVersionUID = 1L;
@Override
public String getQuote() {
return null;
}
@Override
public List<Table> getTables() {
return Collections.singletonList(_outputDataStream.getTable());
}
@Override
public String getName() {
return null;
}
};
}
示例11: findOriginatingTable
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
private Table findOriginatingTable(final InputColumn<?> inputColumn, final Set<Object> resolvedSet) {
if (!resolvedSet.add(inputColumn)) {
logger.debug(LOG_MESSAGE_RECURSIVE_TRAVERSAL);
return null;
}
if (inputColumn == null) {
logger.warn("InputColumn was null, no originating table found");
return null;
}
if (inputColumn.isPhysicalColumn()) {
return inputColumn.getPhysicalColumn().getTable();
}
final InputColumnSourceJob inputColumnSource = findInputColumnSource(inputColumn);
if (!resolvedSet.add(inputColumnSource)) {
logger.debug(LOG_MESSAGE_RECURSIVE_TRAVERSAL);
return null;
}
return findOriginatingTableOfSource(inputColumnSource, resolvedSet);
}
示例12: toString
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
@Override
public String toString(final Object o) {
final String result;
if (o instanceof Schema) {
result = ((Schema) o).getName();
} else if (o instanceof Table) {
result = ((Table) o).getQualifiedLabel();
} else if (o instanceof Column) {
result = ((Column) o).getQualifiedLabel();
} else if (o instanceof Dictionary) {
result = ((Dictionary) o).getName();
} else if (o instanceof SynonymCatalog) {
result = ((SynonymCatalog) o).getName();
} else if (o instanceof StringPattern) {
result = ((StringPattern) o).getName();
} else if (o instanceof Datastore) {
result = ((Datastore) o).getName();
} else {
logger.warn("Could not convert type: {}", o.getClass().getName());
result = o.toString();
}
return result;
}
示例13: compileLookupQuery
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
private void compileLookupQuery() {
try {
final Column[] queryOutputColumns = getQueryOutputColumns(false);
final Column queryOutputColumn = queryOutputColumns[0];
final Table table = queryOutputColumn.getTable();
Query query = new Query().from(table).select(queryOutputColumns);
if (!isCarthesianProductMode()) {
final Column[] queryConditionColumns = getQueryConditionColumns();
for (int i = 0; i < queryConditionColumns.length; i++) {
query = query.where(queryConditionColumns[i], OperatorType.EQUALS_TO, new QueryParameter());
}
}
if (joinSemantic == JoinSemantic.LEFT_JOIN_MAX_ONE) {
query = query.setMaxRows(1);
}
lookupQuery = datastoreConnection.getDataContext().compileQuery(query);
} catch (final RuntimeException e) {
logger.error("Error occurred while compiling lookup query", e);
throw e;
}
}
示例14: executeBlockingly
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
public void executeBlockingly() {
if (!isNeeded()) {
return;
}
final Schema schema = (Schema) _schemaNode.getUserObject();
final List<Table> tables = schema.getTables();
for (final Table table : tables) {
final String name = table.getName();
logger.debug("Building table node: {}", name);
final DefaultMutableTreeNode tableNode = new DefaultMutableTreeNode(table);
final DefaultMutableTreeNode loadingColumnsNode = new DefaultMutableTreeNode(LOADING_COLUMNS_STRING);
tableNode.add(loadingColumnsNode);
_schemaNode.add(tableNode);
}
_schemaNode.remove(0);
}
示例15: truncateIfNecesary
import org.apache.metamodel.schema.Table; //导入依赖的package包/类
/**
* Truncates the database table if necesary. This is NOT a distributable
* initializer, since it can only happen once.
*/
@Initialize(distributed = false)
public void truncateIfNecesary() {
if (truncateTable) {
try (UpdateableDatastoreConnection con = datastore.openConnection()) {
final SchemaNavigator schemaNavigator = con.getSchemaNavigator();
final Table table = schemaNavigator.convertToTable(schemaName, tableName);
final UpdateableDataContext dc = con.getUpdateableDataContext();
dc.executeUpdate(callback -> {
final RowDeletionBuilder delete = callback.deleteFrom(table);
if (logger.isInfoEnabled()) {
logger.info("Executing truncating DELETE operation: {}", delete.toSql());
}
delete.execute();
});
}
}
}