Package org.teiid.metadata

Examples of org.teiid.metadata.ForeignKey


    }

    public Object getPrimaryKeyIDForForeignKeyID(final Object foreignKeyID)
        throws TeiidComponentException, QueryMetadataException {
        ArgCheck.isInstanceOf(ForeignKey.class, foreignKeyID);
        ForeignKey fkRecord = (ForeignKey) foreignKeyID;
        return fkRecord.getPrimaryKey();
    }
View Full Code Here


     * Create a ForeignKeyRecord instance from the specified index record
     */
    public ForeignKey createForeignKeyRecord(final char[] record) {
        final String str = new String(record);
        final List<String> tokens = getStrings(str, IndexConstants.RECORD_STRING.RECORD_DELIMITER);
        final ForeignKey fkRecord = new ForeignKey();

        // Extract the index version information from the record
        int indexVersion = getIndexVersion(record);

        // The tokens are the standard header values
        int tokenIndex = 0;
        setRecordHeaderValues(fkRecord, tokens.get(tokenIndex++), tokens.get(tokenIndex++),
                             tokens.get(tokenIndex++), tokens.get(tokenIndex++),
                             tokens.get(tokenIndex++), tokens.get(tokenIndex++));
       
        // The next token are the UUIDs for the column references
        List<String> uuids = getStrings(tokens.get(tokenIndex++), getListDelimiter(indexVersion));
        fkRecord.setColumns(createColumns(uuids));

        // The next token is the UUID of the unique key
        fkRecord.setUniqueKeyID(getObjectValue(tokens.get(tokenIndex++)));       

    // The next tokens are footer values
    setRecordFooterValues(fkRecord, tokens, tokenIndex);
       
        return fkRecord;
View Full Code Here

    }
    return key;
  }
 
  public static ForeignKey createForeignKey(String name, Table group, List<Column> elements, KeyRecord primaryKey) {
    ForeignKey key = new ForeignKey();
    key.setName(name);
    for (Column column : elements) {
      key.addColumn(column);
    }
    key.setPrimaryKey(primaryKey);
    group.getForeignKeys().add(key);
    return key;
  }
View Full Code Here

TOP

Related Classes of org.teiid.metadata.ForeignKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.