public static final String updateFilenameHashCode ( EnterpriseBean enterpriseBean , String oldName ) { String newName = null ; int len = oldName . length ( ) ; int last_ = ( len > 9 && ( oldName . charAt ( len - 9 ) == ' ' ) ) ? len - 9 : - 1 ; // input file name must have a trailing "_" follows by 8 hex digits // and check to make sure the last 8 characters are all hex digits if ( last_ != - 1 && allHexDigits ( oldName , ++ last_ , len ) ) { String hashStr = getHashStr ( enterpriseBean ) ; newName = oldName . substring ( 0 , last_ ) + BuzzHash . computeHashStringMid32Bit ( hashStr , true ) ; } return newName ; }
Attempts to find the new file name originated from input oldName using the the new modified BuzzHash algorithm . This method detects if the oldName contains a valid trailing hashcode and try to compute the new one . If the oldName has no valid hashcode in the input name null is return . For ease of invocation regardless of the type of file passes in this method only changes the hash value and will not recreate the complete file name from the EnterpriseBean .