register(profileKey, entry.getValue(), session);
}
builtInProfiles.put(language, profileName);
- }
+ }
setDefault(language, profileDefs, session);
- }
+ }
session.commit();
} finally {
session.close();
private void cleanUp(QualityProfileKey key, QualityProfileDto profileDto, DbSession session) {
dbClient.activeRuleDao().deleteByProfileKey(session, key);
dbClient.qualityProfileDao().delete(session, profileDto);
- session.commit();
}
private void insertNewProfile(QualityProfileKey key, DbSession session) {
QualityProfileDto profile = QualityProfileDto.createFor(key);
dbClient.qualityProfileDao().insert(session, profile);
- session.commit();
}
private void setDefault(String language, List<RulesProfile> profileDefs, DbSession session) {
import org.sonar.core.log.Log;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.preview.PreviewCache;
-import org.sonar.core.qualityprofile.db.*;
+import org.sonar.core.qualityprofile.db.ActiveRuleDto;
+import org.sonar.core.qualityprofile.db.ActiveRuleKey;
+import org.sonar.core.qualityprofile.db.ActiveRuleParamDto;
+import org.sonar.core.qualityprofile.db.QualityProfileDto;
+import org.sonar.core.qualityprofile.db.QualityProfileKey;
import org.sonar.core.rule.RuleDto;
import org.sonar.core.rule.RuleParamDto;
import org.sonar.server.db.DbClient;
import org.sonar.server.util.TypeValidations;
import javax.annotation.Nullable;
-
import java.util.Iterator;
import java.util.List;
import java.util.Map;
if (!changes.isEmpty()) {
log.write(dbSession, Log.Type.ACTIVE_RULE, changes);
- dbSession.commit();
previewCache.reportGlobalModification();
}
return changes;
for (ActiveRuleDto activeRule : activeRules) {
changes.addAll(deactivate(dbSession, activeRule.getKey(), true));
}
- dbSession.commit();
return changes;
}
if (!changes.isEmpty()) {
log.write(dbSession, Log.Type.ACTIVE_RULE, changes);
- dbSession.commit();
previewCache.reportGlobalModification();
}