Search in sources :

Example 1 with OrgQProfileDto

use of org.sonar.db.qualityprofile.OrgQProfileDto in project sonarqube by SonarSource.

the class BuiltInQProfileInsertImpl method createDefaultAndOrgQProfiles.

private void createDefaultAndOrgQProfiles(DbSession batchDbSession, BuiltInQProfile builtIn, RulesProfileDto rulesProfileDto) {
    Optional<String> qProfileUuid = dbClient.defaultQProfileDao().selectDefaultQProfileUuid(batchDbSession, builtIn.getLanguage());
    OrgQProfileDto dto = new OrgQProfileDto().setRulesProfileUuid(rulesProfileDto.getUuid()).setUuid(uuidFactory.create());
    if (builtIn.isDefault() && qProfileUuid.isEmpty()) {
        DefaultQProfileDto defaultQProfileDto = new DefaultQProfileDto().setQProfileUuid(dto.getUuid()).setLanguage(builtIn.getLanguage());
        dbClient.defaultQProfileDao().insert(batchDbSession, defaultQProfileDto);
    }
    dbClient.qualityProfileDao().insert(batchDbSession, dto);
}
Also used : DefaultQProfileDto(org.sonar.db.qualityprofile.DefaultQProfileDto) OrgQProfileDto(org.sonar.db.qualityprofile.OrgQProfileDto)

Example 2 with OrgQProfileDto

use of org.sonar.db.qualityprofile.OrgQProfileDto in project sonarqube by SonarSource.

the class QProfileFactoryImplTest method associateBuiltInProfile.

private QProfileDto associateBuiltInProfile(RulesProfileDto rulesProfile) {
    OrgQProfileDto orgQProfileDto = new OrgQProfileDto().setUuid(Uuids.createFast()).setRulesProfileUuid(rulesProfile.getUuid());
    db.getDbClient().qualityProfileDao().insert(dbSession, orgQProfileDto);
    db.commit();
    return QProfileDto.from(orgQProfileDto, rulesProfile);
}
Also used : OrgQProfileDto(org.sonar.db.qualityprofile.OrgQProfileDto)

Aggregations

OrgQProfileDto (org.sonar.db.qualityprofile.OrgQProfileDto)2 DefaultQProfileDto (org.sonar.db.qualityprofile.DefaultQProfileDto)1