edu.harvard.cfa.vo.tapclient.vosi
Class ForeignKey

java.lang.Object
  extended by edu.harvard.cfa.vo.tapclient.vosi.ForeignKey

public class ForeignKey
extends java.lang.Object

A description of a foreign keys, one or more columns from the current table that can be used to join with another table.

See Also:
Table, ForeignKey

Field Summary
protected  java.util.Map<java.lang.String,java.lang.String> fkColumns
           
 
Constructor Summary
protected ForeignKey()
          Constructs a ForeignKey object.
protected ForeignKey(java.lang.String targetTable, java.util.Map<java.lang.String,java.lang.String> fkColumns, java.lang.String description, java.lang.String utype)
          Constructs a ForeignKey object.
 
Method Summary
protected  void add(java.lang.String fromColumn, java.lang.String targetColumn)
           
 java.lang.String getDescription()
          Returns a description of the foreign key.
 java.util.Map<java.lang.String,java.lang.String> getFKColumns()
          Returns a Map of column pairs where the key is the from column in the table containing this foreign key and the value is the column in the target table.
 java.lang.String getTargetTable()
          Returns the name of the table which can be joined with the table containing this ForeignKey object.
 java.lang.String getUtype()
          Returns the utype, usage-specific or unique type, provided for the key.
 void list(java.io.PrintStream output)
           
 void list(java.io.PrintStream output, java.lang.String indent)
           
 java.lang.String toString()
          Returns a String representation of the this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fkColumns

protected java.util.Map<java.lang.String,java.lang.String> fkColumns
Constructor Detail

ForeignKey

protected ForeignKey()
Constructs a ForeignKey object. For use by subclasses.


ForeignKey

protected ForeignKey(java.lang.String targetTable,
                     java.util.Map<java.lang.String,java.lang.String> fkColumns,
                     java.lang.String description,
                     java.lang.String utype)
Constructs a ForeignKey object. For use by subclasses.

Method Detail

getTargetTable

public java.lang.String getTargetTable()
Returns the name of the table which can be joined with the table containing this ForeignKey object. The name is taken verbatim from the service response but should be a qualified name, with schema name, if applicable.

Returns:
the target table of the association or null if not provided.

getFKColumns

public java.util.Map<java.lang.String,java.lang.String> getFKColumns()
Returns a Map of column pairs where the key is the from column in the table containing this foreign key and the value is the column in the target table.
   Map fkColumnMap = fkColumnPari: getFKColumns();
   Iteartor> iterator = fkColumnMap.entrySet().iterator();
   while (iteartor.hasNext()) {
       Map.Entry fkColumnPair = iterator.next();
       System.out.println(table.getName()+"."+fkColumnPair.getKey()+
                          " = "+
                          foreignKey.getTargetTable()+"."+fkColumnPair.getValue();
   }
 

Returns:
a list of columns, represented as FKColumn objects, that constitue the foreign key.

add

protected void add(java.lang.String fromColumn,
                   java.lang.String targetColumn)

getDescription

public java.lang.String getDescription()
Returns a description of the foreign key.

Returns:
a description of this ForeignKey object or null if not defined

getUtype

public java.lang.String getUtype()
Returns the utype, usage-specific or unique type, provided for the key.

Returns:
the utype of this ForeignKey object or null if not defined

toString

public java.lang.String toString()
Returns a String representation of the this object. This method is intended to be used only for debugging purposes, and the format of the returned string may vary between implementations.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of the this object.

list

public void list(java.io.PrintStream output)

list

public void list(java.io.PrintStream output,
                 java.lang.String indent)