Search in sources :

Example 6 with TableWireFormat

use of org.teiid.infinispan.api.TableWireFormat in project teiid by teiid.

the class MarshallerBuilder method getWireMap.

public static TreeMap<Integer, TableWireFormat> getWireMap(Table parentTbl, RuntimeMetadata metadata) throws TranslatorException {
    TreeMap<Integer, TableWireFormat> wireMap = buildWireMap(parentTbl, false, metadata);
    Schema schema = parentTbl.getParent();
    for (Table table : schema.getTables().values()) {
        if (table.equals(parentTbl)) {
            continue;
        }
        String mergeName = ProtobufMetadataProcessor.getMerge(table);
        if (mergeName != null && mergeName.equals(parentTbl.getFullName())) {
            // one 2 many relation
            int parentTag = ProtobufMetadataProcessor.getParentTag(table);
            String childName = ProtobufMetadataProcessor.getMessageName(table);
            TableWireFormat child = new TableWireFormat(childName, parentTag);
            wireMap.put(child.getReadTag(), child);
            TreeMap<Integer, TableWireFormat> childWireMap = buildWireMap(table, true, metadata);
            for (TableWireFormat twf : childWireMap.values()) {
                child.addNested(twf);
            }
        }
    }
    return wireMap;
}
Also used : Table(org.teiid.metadata.Table) Schema(org.teiid.metadata.Schema) TableWireFormat(org.teiid.infinispan.api.TableWireFormat)

Aggregations

TableWireFormat (org.teiid.infinispan.api.TableWireFormat)6 InfinispanDocument (org.teiid.infinispan.api.InfinispanDocument)3 Column (org.teiid.metadata.Column)2 Timestamp (java.sql.Timestamp)1 TreeMap (java.util.TreeMap)1 Test (org.junit.Test)1 RuntimeMetadataImpl (org.teiid.dqp.internal.datamgr.RuntimeMetadataImpl)1 MetadataFactory (org.teiid.metadata.MetadataFactory)1 Schema (org.teiid.metadata.Schema)1 Table (org.teiid.metadata.Table)1 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)1 RealMetadataFactory (org.teiid.query.unittest.RealMetadataFactory)1