本文整理汇总了Java中org.apache.metamodel.schema.Column.getTable方法的典型用法代码示例。如果您正苦于以下问题:Java Column.getTable方法的具体用法?Java Column.getTable怎么用?Java Column.getTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.metamodel.schema.Column
的用法示例。
在下文中一共展示了Column.getTable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compileLookupQuery
import org.apache.metamodel.schema.Column; //导入方法依赖的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;
}
}
示例2: compileLookupQuery
import org.apache.metamodel.schema.Column; //导入方法依赖的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 (RuntimeException e) {
logger.error("Error occurred while compiling lookup query", e);
throw e;
}
}
示例3: addPhysicalColumns
import org.apache.metamodel.schema.Column; //导入方法依赖的package包/类
public void addPhysicalColumns(final List<Column> columns) {
for (final Column column : columns) {
if (!getTable().equals(column.getTable())) {
throw new IllegalArgumentException(
"Column does not pertain to the correct table. Expected table: " + getTable()
+ ", actual table: " + column.getTable());
}
_physicalColumns.add(column);
}
}
示例4: onAdd
import org.apache.metamodel.schema.Column; //导入方法依赖的package包/类
@Override
public void onAdd(final InputColumn<?> column) {
final Column physicalColumn = column.getPhysicalColumn();
if (physicalColumn != null) {
if (physicalColumn.getTable() == _table) {
_columnListTable.addColumn(column);
}
}
}
示例5: getSourceColumnsOfTable
import org.apache.metamodel.schema.Column; //导入方法依赖的package包/类
public List<MetaModelInputColumn> getSourceColumnsOfTable(Table table) {
final List<MetaModelInputColumn> result = new ArrayList<>();
for (MetaModelInputColumn column : _sourceColumns) {
final Column physicalColumn = column.getPhysicalColumn();
if (physicalColumn != null && physicalColumn.getTable() == table) {
result.add(column);
}
}
return result;
}
示例6: addPhysicalColumns
import org.apache.metamodel.schema.Column; //导入方法依赖的package包/类
public void addPhysicalColumns(Column... columns) {
for (Column column : columns) {
if (!_table.equals(column.getTable())) {
throw new IllegalArgumentException("Column does not pertain to the correct table. Expected table: "
+ _table + ", actual table: " + column.getTable());
}
_physicalColumns.add(column);
}
}
示例7: getSynonyms
import org.apache.metamodel.schema.Column; //导入方法依赖的package包/类
@Override
public Collection<Synonym> getSynonyms() {
final Datastore datastore = getDatastore();
try (DatastoreConnection datastoreConnection = datastore.openConnection()) {
final DataContext dataContext = datastoreConnection.getDataContext();
final SchemaNavigator schemaNavigator = datastoreConnection.getSchemaNavigator();
final Column masterTermColumn = schemaNavigator.convertToColumn(_masterTermColumnPath);
final Column[] columns = schemaNavigator.convertToColumns(_synonymColumnPaths);
final Table table = masterTermColumn.getTable();
final Query query = dataContext.query().from(table.getName()).select(masterTermColumn).select(columns)
.toQuery();
final DataSet results = dataContext.executeQuery(query);
final List<Synonym> synonyms = new ArrayList<Synonym>();
while (results.next()) {
final Row row = results.getRow();
synonyms.add(new SimpleSynonym(getMasterTerm(row, masterTermColumn), getSynonyms(row,
table.getColumns())));
}
return synonyms;
}
}
示例8: getMasterTerm
import org.apache.metamodel.schema.Column; //导入方法依赖的package包/类
@Override
public String getMasterTerm(String term) {
if (StringUtils.isNullOrEmpty(term)) {
return null;
}
final Cache<String, String> cache = getMasterTermCache();
String result;
synchronized (cache) {
result = cache.getIfPresent(term);
if (result == null) {
final Datastore datastore = getDatastore();
try (final DatastoreConnection datastoreConnection = datastore.openConnection()) {
final SchemaNavigator schemaNavigator = datastoreConnection.getSchemaNavigator();
final Column masterTermColumn = schemaNavigator.convertToColumn(_masterTermColumnPath);
final Column[] columns = schemaNavigator.convertToColumns(_synonymColumnPaths);
final DataContext dataContext = datastoreConnection.getDataContext();
final Table table = masterTermColumn.getTable();
// create a query that gets the master term where any of the
// synonym columns are equal to the synonym
final Query query = dataContext.query().from(table.getName()).select(masterTermColumn).toQuery();
final List<FilterItem> filterItems = new ArrayList<FilterItem>();
for (int i = 0; i < columns.length; i++) {
final Column column = columns[i];
if (column.getType().isNumber()) {
final Number numberValue = ConvertToNumberTransformer.transformValue(term);
if (numberValue != null) {
filterItems.add(new FilterItem(new SelectItem(column), OperatorType.EQUALS_TO,
numberValue));
}
} else {
filterItems.add(new FilterItem(new SelectItem(column), OperatorType.EQUALS_TO, term));
}
}
if (filterItems.isEmpty()) {
result = "";
} else {
query.where(new FilterItem(filterItems.toArray(new FilterItem[0])));
try (final DataSet dataSet = dataContext.executeQuery(query)) {
if (dataSet.next()) {
final Row row = dataSet.getRow();
result = getMasterTerm(row, masterTermColumn);
} else {
result = "";
}
}
}
}
cache.put(term, result);
}
}
if ("".equals(result)) {
result = null;
}
return result;
}