FileDocCategorySizeDatePackage
ForeignKeyImpl.javaAPI DocExample1681Tue Dec 08 01:21:00 GMT 1998oisoft.togetherx.scripts.SQL.impl

ForeignKeyImpl

public class ForeignKeyImpl extends Object implements oisoft.togetherx.scripts.SQL.SQLForeignKey

Fields Summary
private TableImpl
myTable
private oisoft.togetherx.scripts.SQL.SQLTable
myReferencedTable
private boolean
myForcePrimaryKey
Constructors Summary
ForeignKeyImpl(TableImpl table, oisoft.togetherx.scripts.SQL.SQLTable referencedTable, boolean forcePrimaryKey)

    myTable = table;
    myReferencedTable = referencedTable;
    myForcePrimaryKey = forcePrimaryKey;
  
Methods Summary
public java.util.EnumerationgetColumns()

    boolean showForeign = !myTable.equals(getReferencedTable());
    UnaryFunction filter
      = new UnaryFunction(){
          public Object execute(Object arg){
            if( !(arg instanceof ColumnImpl) ){
              return null;
            }
            else{
              return myTable.getForeignKeyColumn((ColumnImpl)arg, myForcePrimaryKey);
            }
          }
        };
    Enumeration source = null;
    if( getReferencedTable() instanceof TableImpl ){
      source = ((TableImpl)getReferencedTable()).getPrimaryKeyColumns(showForeign);
    }
    else{
      source = new EmptyEnumeration();
    }

    return new FilterEnumeration(source, filter);
  
public java.lang.StringgetName()

    return myTable.getForeignKeyName(this);
  
public java.util.EnumerationgetReferencedColumns()

    return getReferencedTable().getPrimaryKeyColumns();
  
public oisoft.togetherx.scripts.SQL.SQLTablegetReferencedTable()

    return myReferencedTable;
  
public oisoft.togetherx.scripts.SQL.SQLTablegetTable()

    return myTable;