private String fixDatabaseName ( String databaseName , Record record , Map < String , String > oldProperties ) { if ( databaseName . endsWith ( BaseDatabase . SHARED_SUFFIX ) ) databaseName = databaseName . substring ( 0 , databaseName . length ( ) - BaseDatabase . SHARED_SUFFIX . length ( ) ) ; else if ( databaseName . endsWith ( BaseDatabase . USER_SUFFIX ) ) databaseName = databaseName . substring ( 0 , databaseName . length ( ) - BaseDatabase . USER_SUFFIX . length ( ) ) ; String recordDBName = record . getDatabaseName ( ) ; if ( record instanceof DatabaseInfo ) recordDBName = DatabaseInfo . DATABASE_INFO_FILE ; if ( ! databaseName . startsWith ( recordDBName ) ) { // Typically user name this . getTask ( ) . setProperty ( DBConstants . DB_USER_PREFIX , databaseName . substring ( 0 , databaseName . indexOf ( ' ' ) ) ) ; databaseName = databaseName . substring ( databaseName . indexOf ( ' ' ) + 1 ) ; } if ( ! databaseName . endsWith ( recordDBName ) ) { String suffix = databaseName . substring ( databaseName . lastIndexOf ( ' ' ) + 1 ) ; if ( suffix . length ( ) == 2 ) { // Typically language this . getTask ( ) . setProperty ( DBParams . LANGUAGE , suffix ) ; databaseName = databaseName . substring ( 0 , databaseName . lastIndexOf ( ' ' ) ) ; suffix = databaseName . substring ( databaseName . lastIndexOf ( ' ' ) + 1 ) ; } if ( ! databaseName . endsWith ( recordDBName ) ) { databaseName = databaseName . substring ( 0 , databaseName . lastIndexOf ( ' ' ) ) ; if ( ( record . getDatabaseType ( ) & DBConstants . USER_DATA ) != 0 ) this . getTask ( ) . setProperty ( record . getDatabaseName ( ) + BaseDatabase . DBUSER_PARAM_SUFFIX , suffix ) ; else this . getTask ( ) . setProperty ( record . getDatabaseName ( ) + BaseDatabase . DBSHARED_PARAM_SUFFIX , suffix ) ; suffix = databaseName . substring ( databaseName . lastIndexOf ( ' ' ) + 1 ) ; //? } if ( ! databaseName . endsWith ( recordDBName ) ) { this . getTask ( ) . setProperty ( DBConstants . SYSTEM_NAME , suffix ) ; databaseName = databaseName . substring ( 0 , databaseName . lastIndexOf ( ' ' ) ) ; } } return databaseName ; }
Clean up the database name ;