private static void processJoinTables ( final List < TableModel > result , final Map < String , Map < Table , List < String > > > joinTableMetadata ) { joinTableMetadata . entrySet ( ) . forEach ( entry -> { LOG . debug ( "Processing join tables for {}. Found {} join tables to process" , entry . getKey ( ) , entry . getValue ( ) . size ( ) ) ; final TableModel model = getModelBySQLName ( result , entry . getKey ( ) ) ; if ( model == null ) { LOG . error ( "Could not find table {} in the already generated models! This should not happen!" , entry . getKey ( ) ) ; throw new NullPointerException ( "Table model not found" ) ; } entry . getValue ( ) . entrySet ( ) . forEach ( tableListEntry -> { LOG . debug ( "Processing join table {}" , tableListEntry . getKey ( ) . getFullName ( ) ) ; final TableModel joinTable = getModelBySQLName ( result , tableListEntry . getKey ( ) . getFullName ( ) ) ; if ( joinTable == null ) { LOG . error ( "Could not find join table {} in the already generated models! This should not happen!" , entry . getKey ( ) ) ; throw new NullPointerException ( "Table model not found" ) ; } JoinTableSimplifierModel jtsModel = new JoinTableSimplifierModel ( ) ; jtsModel . setName ( joinTable . getName ( ) ) ; for ( ForeignKeyModel fKModel : joinTable . getForeignKeys ( ) ) { if ( fKModel . getJavaTypeName ( ) . equals ( model . getClassName ( ) ) ) { jtsModel . getConstructorParams ( ) . add ( "this" ) ; } else { jtsModel . getConstructorParams ( ) . add ( fKModel . getName ( ) ) ; jtsModel . getMethodParams ( ) . put ( fKModel . getJavaTypeName ( ) , fKModel . getName ( ) ) ; } } model . getJoinTableSimplifierData ( ) . put ( joinTable . getClassName ( ) , jtsModel ) ; } ) ; } ) ; }
Processes the information about the join tables that were collected during table model extraction .