public LogicalRelationship findRelationshipUsing( LogicalTable one, LogicalTable two ) { for ( LogicalRelationship relationship : getLogicalRelationships() ) { if ( relationship.isUsingTable( one ) && relationship.isUsingTable( two ) ) { return relationship; } } return null; }
private static LogicalRelationship findRelationshipUsing( LogicalModel model, LogicalTable one, LogicalTable two ) { for ( LogicalRelationship rel : model.getLogicalRelationships() ) { if ( rel.isUsingTable( one ) && rel.isUsingTable( two ) ) { return rel; } } return null; }
/** * @param businessTable * The table to calculate the number of neighbours for. * @param selectedTables * The list of selected business tables. * @return The number of neighbours in a list of selected tables using the relationships defined in this business * Model. */ private static int getNrNeighbours( LogicalModel model, LogicalTable businessTable, List<LogicalTable> selectedTables ) { int nr = 0; for ( LogicalRelationship relationship : model.getLogicalRelationships() ) { if ( relationship.isUsingTable( businessTable ) ) { // See if one of the selected tables is also using this relationship. // If so, we have a neighbour in the selected tables. // boolean found = false; for ( int s = 0; s < selectedTables.size() && !found; s++ ) { LogicalTable selectedTable = selectedTables.get( s ); if ( relationship.isUsingTable( selectedTable ) && !businessTable.equals( selectedTable ) ) { nr++; } } } } return nr; }
public boolean contains( LogicalTable tab ) { if ( tab == null ) { return false; } for ( int i = 0; i < size(); i++ ) { LogicalRelationship check = getRelationship( i ); if ( check.isUsingTable( tab ) ) { return true; } } return false; }
continue; if ( rel.isUsingTable( aliasedTable ) ) { if ( rel.isUsingTable( defaultTable ) ) { boolean inAliasedTables = false; for ( LogicalTable aliased : aliasedTables ) {