use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class AlmConfigurationSection method toProtobuf.
@Override
public ProtobufSystemInfo.Section toProtobuf() {
ProtobufSystemInfo.Section.Builder protobuf = ProtobufSystemInfo.Section.newBuilder();
protobuf.setName("ALMs");
try (DbSession dbSession = dbClient.openSession(false)) {
List<AlmSettingDto> almSettingDtos = dbClient.almSettingDao().selectAll(dbSession);
for (AlmSettingDto almSettingDto : almSettingDtos) {
setAttribute(protobuf, almSettingDto.getKey(), buildValue(almSettingDto));
}
}
return protobuf.build();
}
use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class AzureMetricsTask method run.
@Override
public void run() {
try (DbSession dbSession = dbClient.openSession(false)) {
List<AlmSettingDto> azureSettingsDtos = dbClient.almSettingDao().selectByAlm(dbSession, ALM.AZURE_DEVOPS);
if (azureSettingsDtos.isEmpty()) {
metrics.setAzureStatusToRed();
return;
}
validate(azureSettingsDtos);
}
}
use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class CountBindingAction method doHandle.
private CountBindingWsResponse doHandle(Request request) {
String almSettingKey = request.mandatoryParam(PARAM_ALM_SETTING);
try (DbSession dbSession = dbClient.openSession(false)) {
AlmSettingDto almSetting = almSettingsSupport.getAlmSetting(dbSession, almSettingKey);
int projectsBound = dbClient.projectAlmSettingDao().countByAlmSetting(dbSession, almSetting);
return CountBindingWsResponse.newBuilder().setKey(almSetting.getKey()).setProjects(projectsBound).build();
}
}
use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class CreateGithubAction method doHandle.
private void doHandle(Request request) {
String key = request.mandatoryParam(PARAM_KEY);
String url = request.mandatoryParam(PARAM_URL);
String appId = request.mandatoryParam(PARAM_APP_ID);
String clientId = request.mandatoryParam(PARAM_CLIENT_ID);
String clientSecret = request.mandatoryParam(PARAM_CLIENT_SECRET);
String privateKey = request.mandatoryParam(PARAM_PRIVATE_KEY);
if (url.endsWith("/")) {
url = url.substring(0, url.length() - 1);
}
try (DbSession dbSession = dbClient.openSession(false)) {
almSettingsSupport.checkAlmMultipleFeatureEnabled(GITHUB);
almSettingsSupport.checkAlmSettingDoesNotAlreadyExist(dbSession, key);
dbClient.almSettingDao().insert(dbSession, new AlmSettingDto().setAlm(GITHUB).setKey(key).setUrl(url).setAppId(appId).setPrivateKey(privateKey).setClientId(clientId).setClientSecret(clientSecret));
dbSession.commit();
}
}
use of org.sonar.db.alm.setting.AlmSettingDto in project sonarqube by SonarSource.
the class DeleteAction method doHandle.
private void doHandle(Request request) {
String key = request.mandatoryParam(PARAM_KEY);
try (DbSession dbSession = dbClient.openSession(false)) {
AlmSettingDto almSettingDto = almSettingsSupport.getAlmSetting(dbSession, key);
dbClient.projectAlmSettingDao().deleteByAlmSetting(dbSession, almSettingDto);
dbClient.almPatDao().deleteByAlmSetting(dbSession, almSettingDto);
dbClient.almSettingDao().delete(dbSession, almSettingDto);
dbSession.commit();
}
}
Aggregations