private static Set < Table > getReferencingTables ( Table table ) { Set < Table > referencingTables = new HashSet <> ( ) ; for ( Table gtfsTable : Table . tablesInOrder ) { // IMPORTANT: Skip the table for the entity we're modifying or if loop table does not have field. if ( table . name . equals ( gtfsTable . name ) ) continue ; for ( Field field : gtfsTable . fields ) { if ( field . isForeignReference ( ) && field . referenceTable . name . equals ( table . name ) ) { // If any of the table's fields are foreign references to the specified table, add to the return set. referencingTables . add ( gtfsTable ) ; } } } return referencingTables ; }
Finds the set of tables that reference the parent entity being updated .