public boolean readCurrentUser ( ) { String strUserName = this . getProperty ( DBParams . USER_NAME ) ; String strUserID = this . getProperty ( DBParams . USER_ID ) ; boolean bUserFound = false ; if ( ( this . getMainRecord ( ) . getEditMode ( ) == DBConstants . EDIT_CURRENT ) || ( this . getMainRecord ( ) . getEditMode ( ) == DBConstants . EDIT_IN_PROGRESS ) ) { bUserFound = true ; } else { if ( ( strUserID != null ) && ( strUserID . length ( ) > 0 ) ) { bUserFound = ( ( UserInfo ) this . getMainRecord ( ) ) . getUserInfo ( strUserID , false ) ; if ( bUserFound ) if ( this . getMainRecord ( ) . getField ( UserInfo . READ_ONLY_RECORD ) . getState ( ) == true ) bUserFound = false ; // Can't change anonymous } if ( ! bUserFound ) if ( ( strUserName != null ) && ( strUserName . length ( ) > 0 ) ) { bUserFound = ( ( UserInfo ) this . getMainRecord ( ) ) . getUserInfo ( strUserName , false ) ; if ( bUserFound ) if ( this . getMainRecord ( ) . getField ( UserInfo . READ_ONLY_RECORD ) . getState ( ) == true ) bUserFound = false ; // Can't change anonymous } } if ( ! bUserFound ) { try { this . getMainRecord ( ) . addNew ( ) ; } catch ( DBException e ) { e . printStackTrace ( ) ; } this . getMainRecord ( ) . getField ( UserInfo . USER_NAME ) . setString ( strUserName ) ; this . getMainRecord ( ) . getField ( UserInfo . USER_NAME ) . setModified ( false ) ; // Don't force a write } else { // TODO What do I do if this user exists? } return bUserFound ; }
ReadCurrentUser Method .