private void renameOutdatedProfiles(DbSession dbSession, BuiltInQProfile profile) {
    Collection<String> uuids = dbClient.qualityProfileDao().selectUuidsOfCustomRulesProfiles(dbSession, profile.getLanguage(), profile.getName());
    if (uuids.isEmpty()) {
      return;
    }
    Profiler profiler = Profiler.createIfDebug(Loggers.get(getClass())).start();
    String newName = profile.getName() + " (outdated copy)";
    LOGGER.info("Rename Quality profiles [{}/{}] to [{}] in {} organizations", profile.getLanguage(), profile.getName(), newName, uuids.size());
    dbClient.qualityProfileDao().renameRulesProfilesAndCommit(dbSession, uuids, newName);
    profiler.stopDebug(format("%d Quality profiles renamed to [%s]", uuids.size(), newName));
  }
private void renameOutdatedProfiles ( DbSession dbSession , BuiltInQProfile profile ) { Collection < String > uuids = dbClient . qualityProfileDao ( ) . selectUuidsOfCustomRulesProfiles ( dbSession , profile . getLanguage ( ) , profile . getName ( ) ) ; if ( uuids . isEmpty ( ) ) { return ; } Profiler profiler = Profiler . createIfDebug ( Loggers . get ( getClass ( ) ) ) . start ( ) ; String newName = profile . getName ( ) + " (outdated copy)" ; LOGGER . info ( "Rename Quality profiles [{}/{}] to [{}] in {} organizations" , profile . getLanguage ( ) , profile . getName ( ) , newName , uuids . size ( ) ) ; dbClient . qualityProfileDao ( ) . renameRulesProfilesAndCommit ( dbSession , uuids , newName ) ; profiler . stopDebug ( format ( "%d Quality profiles renamed to [%s]" , uuids . size ( ) , newName ) ) ; }
The Quality profiles created by users should be renamed when they have the same name
as the built-in profile to be persisted.
<p>
When upgrading from < 6.5 , all existing profiles are considered as "custom" (created
by users) because the concept of built-in profile is not persisted. The "Sonar way" profiles
are renamed to "Sonar way (outdated copy) in order to avoid conflicts with the new
built-in profile "Sonar way", which has probably different configuration.