use of org.teiid.metadata.Table in project teiid by teiid.
the class CassandraMetadataProcessor method addTable.
/**
* Adds table.
* @param columnFamily
*/
private void addTable(MetadataFactory factory, TableMetadata columnFamily) {
Table table = factory.addTable(columnFamily.getName());
addColumnsToTable(factory, table, columnFamily);
addPrimaryKey(factory, table, columnFamily);
for (IndexMetadata index : columnFamily.getIndexes()) {
Column c = table.getColumnByName(index.getTarget());
if (c != null) {
c.setSearchType(SearchType.Searchable);
factory.addIndex(index.getName(), false, Arrays.asList(index.getTarget()), table);
}
}
table.setSupportsUpdate(true);
}
use of org.teiid.metadata.Table in project teiid by teiid.
the class TestTeiidLanguageToCQL method createFakeMetadata.
private void createFakeMetadata(MetadataFactory factory) {
Table person = factory.addTable("Person");
factory.addColumn("id", TypeFacility.RUNTIME_NAMES.INTEGER, person);
factory.addColumn("name", TypeFacility.RUNTIME_NAMES.STRING, person);
factory.addColumn("age", TypeFacility.RUNTIME_NAMES.INTEGER, person);
factory.addColumn("bday", TypeFacility.RUNTIME_NAMES.TIMESTAMP, person);
factory.addColumn("employed", TypeFacility.RUNTIME_NAMES.BOOLEAN, person);
factory.addColumn("custom", TypeFacility.RUNTIME_NAMES.VARBINARY, person);
factory.addColumn("custom1", TypeFacility.RUNTIME_NAMES.BLOB, person);
Properties pros = factory.getModelProperties();
for (Object key : pros.keySet()) {
person.setProperty(key.toString(), pros.getProperty(key.toString()));
}
}
use of org.teiid.metadata.Table in project teiid by teiid.
the class CompositeMetadataStore method assignOids.
private void assignOids(Schema schema, TreeMap<String, RecordHolder> map) {
addOid(schema, map);
for (Table table : schema.getTables().values()) {
addOid(table, map);
addOids(table.getColumns(), map);
addOids(table.getAllKeys(), map);
}
for (Procedure proc : schema.getProcedures().values()) {
addOid(proc, map);
addOids(proc.getParameters(), map);
if (proc.getResultSet() != null) {
addOids(proc.getResultSet().getColumns(), map);
}
}
for (FunctionMethod func : schema.getFunctions().values()) {
addOid(func, map);
addOids(func.getInputParameters(), map);
addOid(func.getOutputParameter(), map);
}
}
use of org.teiid.metadata.Table in project teiid by teiid.
the class CompositeMetadataStore method getXMLTempGroups.
/*
* The next method is a hold over from XML/UUID resolving and will perform poorly
*/
public Collection<Table> getXMLTempGroups(Table tableRecord) {
ArrayList<Table> results = new ArrayList<Table>();
String namePrefix = tableRecord.getName() + TransformationMetadata.DELIMITER_STRING;
for (Table table : tableRecord.getParent().getTables().values()) {
if (table.getTableType() == Type.XmlStagingTable && table.getName().startsWith(namePrefix)) {
results.add(table);
}
}
return results;
}
use of org.teiid.metadata.Table in project teiid by teiid.
the class MaterializationMetadataRepository method loadMetadata.
// Status table column names
// VDBName, VDBVersion, SchemaName, Name, TargetSchemaName, TargetName, Valid, LoadState, Updated, Cardinality, LoadNumber
@Override
public void loadMetadata(MetadataFactory factory, ExecutionFactory executionFactory, Object connectionFactory) throws TranslatorException {
for (Table table : factory.getSchema().getTables().values()) {
if (table.isMaterialized()) {
// external materialization
if (table.getMaterializedTable() != null) {
String manage = table.getProperty(ALLOW_MATVIEW_MANAGEMENT, false);
if (!Boolean.valueOf(manage)) {
continue;
}
fixScript(ON_VDB_START_SCRIPT, table);
fixScript(ON_VDB_DROP_SCRIPT, table);
fixScript(MATVIEW_BEFORE_LOAD_SCRIPT, table);
fixScript(MATVIEW_AFTER_LOAD_SCRIPT, table);
fixScript(MATVIEW_LOAD_SCRIPT, table);
} else {
// internal materialization
}
}
}
}
Aggregations