use of org.sonar.db.DbSession in project sonarqube by SonarSource.
the class PersistCrossProjectDuplicationIndexStep method execute.
@Override
public void execute() {
if (!crossProjectDuplicationStatusHolder.isEnabled()) {
return;
}
try (DbSession dbSession = dbClient.openSession(true)) {
Component project = treeRootHolder.getRoot();
new DepthTraversalTypeAwareCrawler(new DuplicationVisitor(dbSession, analysisMetadataHolder.getUuid())).visit(project);
dbSession.commit();
}
}
use of org.sonar.db.DbSession in project sonarqube by SonarSource.
the class PersistProjectLinksStep method execute.
@Override
public void execute() {
try (DbSession session = dbClient.openSession(false)) {
new DepthTraversalTypeAwareCrawler(new ProjectLinkVisitor(session)).visit(treeRootHolder.getRoot());
session.commit();
}
}
use of org.sonar.db.DbSession in project sonarqube by SonarSource.
the class PersistTestsStep method execute.
@Override
public void execute() {
try (DbSession dbSession = dbClient.openSession(true)) {
TestDepthTraversalTypeAwareVisitor visitor = new TestDepthTraversalTypeAwareVisitor(dbSession);
new DepthTraversalTypeAwareCrawler(visitor).visit(treeRootHolder.getRoot());
dbSession.commit();
if (visitor.hasUnprocessedCoverageDetails) {
LOG.warn("Some coverage tests are not taken into account during analysis of project '{}'", visitor.getProjectKey());
}
}
}
use of org.sonar.db.DbSession in project sonarqube by SonarSource.
the class PurgeDatastoresStep method execute.
private void execute(Component root) {
try (DbSession dbSession = dbClient.openSession(true)) {
IdUuidPair idUuidPair = new IdUuidPair(dbIdsRepository.getComponentId(root), root.getUuid());
projectCleaner.purge(dbSession, idUuidPair, settingsRepository.getSettings(root), disabledComponentsHolder.getUuids());
dbSession.commit();
}
}
use of org.sonar.db.DbSession in project sonarqube by SonarSource.
the class UpdateQualityProfilesLastUsedDateStep method execute.
@Override
public void execute() {
try (DbSession dbSession = dbClient.openSession(true)) {
Component root = treeRootHolder.getRoot();
Metric metric = metricRepository.getByKey(QUALITY_PROFILES_KEY);
Set<QualityProfile> qualityProfiles = parseQualityProfiles(measureRepository.getRawMeasure(root, metric));
if (qualityProfiles.isEmpty()) {
return;
}
List<QualityProfileDto> dtos = dbClient.qualityProfileDao().selectByKeys(dbSession, qualityProfiles.stream().map(QualityProfile::getQpKey).collect(Collectors.toList()));
dtos.addAll(getAncestors(dbSession, dtos));
long analysisDate = analysisMetadataHolder.getAnalysisDate();
dtos.forEach(dto -> {
dto.setLastUsed(analysisDate);
dbClient.qualityProfileDao().update(dbSession, dto);
});
dbSession.commit();
}
}
Aggregations