public RecordOwner findRecordOwner ( ) { RecordOwner recordOwner = this . getRecordOwner ( ) ; if ( recordOwner instanceof org . jbundle . base . db . shared . FakeRecordOwner ) recordOwner = null ; BaseListener listener = this . getListener ( ) ; while ( ( recordOwner == null ) && ( listener != null ) ) { BaseListener listenerDep = listener . getDependentListener ( ) ; if ( listenerDep != null ) if ( listenerDep . getListenerOwner ( ) instanceof RecordOwner ) recordOwner = ( RecordOwner ) listenerDep . getListenerOwner ( ) ; listener = listener . getNextListener ( ) ; } if ( recordOwner == null ) if ( this . getTable ( ) != null ) if ( this . getTable ( ) . getDatabase ( ) != null ) if ( this . getTable ( ) . getDatabase ( ) . getDatabaseOwner ( ) instanceof Application ) { App app = ( App ) this . getTable ( ) . getDatabase ( ) . getDatabaseOwner ( ) ; if ( app . getSystemRecordOwner ( ) == null ) // This should be okay... get the system recordowner. app = ( ( Environment ) this . getTable ( ) . getDatabase ( ) . getDatabaseOwner ( ) . getEnvironment ( ) ) . getDefaultApplication ( ) ; if ( app != null ) { if ( app . getSystemRecordOwner ( ) instanceof RecordOwner ) recordOwner = ( RecordOwner ) app . getSystemRecordOwner ( ) ; else { Environment env = ( Environment ) this . getTable ( ) . getDatabase ( ) . getDatabaseOwner ( ) . getEnvironment ( ) ; for ( int i = env . getApplicationCount ( ) - 1 ; i >= 0 ; i -- ) { app = env . getApplication ( i ) ; if ( app instanceof MainApplication ) if ( app . getSystemRecordOwner ( ) instanceof RecordOwner ) recordOwner = ( RecordOwner ) app . getSystemRecordOwner ( ) ; } } } } return recordOwner ; }
Get a recordowner from this record . This method does a deep search using the listeners and the database connections to find a recordowner .