public boolean keyInBase ( Record recClassInfo , Record recKeyInfo ) { try { if ( recClassInfo2 == null ) recClassInfo2 = new ClassInfo ( this ) ; if ( recKeyInfo2 == null ) { recKeyInfo2 = new KeyInfo ( this ) ; recKeyInfo2 . setKeyArea ( KeyInfo . KEY_FILENAME_KEY ) ; SubFileFilter keyBehavior = new SubFileFilter ( recClassInfo2 . getField ( ClassInfo . CLASS_NAME ) , KeyInfo . KEY_FILENAME , null , null , null , null ) ; recKeyInfo2 . addListener ( keyBehavior ) ; } String baseClass = recClassInfo . getField ( ClassInfo . BASE_CLASS_NAME ) . toString ( ) ; while ( ( baseClass != null ) && ( baseClass . length ( ) > 0 ) && ( ! "FieldList" . equalsIgnoreCase ( baseClass ) ) ) { recClassInfo2 . getField ( ClassInfo . CLASS_NAME ) . setString ( baseClass ) ; recClassInfo2 . setKeyArea ( ClassInfo . CLASS_NAME_KEY ) ; if ( ! recClassInfo2 . seek ( "=" ) ) // Get this class record back break ; recKeyInfo2 . close ( ) ; while ( recKeyInfo2 . hasNext ( ) ) { recKeyInfo2 . next ( ) ; String keyName = recKeyInfo . getField ( KeyInfo . KEY_NAME ) . toString ( ) ; if ( ( keyName == null ) || ( keyName . length ( ) == 0 ) ) keyName = recKeyInfo . getField ( KeyInfo . KEY_FIELD_1 ) . toString ( ) ; String keyName2 = recKeyInfo2 . getField ( KeyInfo . KEY_NAME ) . toString ( ) ; if ( ( keyName2 == null ) || ( keyName2 . length ( ) == 0 ) ) keyName2 = recKeyInfo2 . getField ( KeyInfo . KEY_FIELD_1 ) . toString ( ) ; if ( keyName2 . equals ( keyName ) ) return true ; // Match! } baseClass = recClassInfo2 . getField ( ClassInfo . BASE_CLASS_NAME ) . toString ( ) ; } } catch ( DBException e ) { e . printStackTrace ( ) ; } return false ; // Not in base }
Is this key already included in a base record?