use of org.sonar.server.setting.ws.SettingValidations.SettingData in project sonarqube by SonarSource.
the class ResetAction method handle.
@Override
public void handle(Request request, Response response) throws Exception {
try (DbSession dbSession = dbClient.openSession(false)) {
ResetRequest resetRequest = toWsRequest(request);
Optional<ComponentDto> component = getComponent(dbSession, resetRequest);
checkPermissions(component);
resetRequest.getKeys().forEach(key -> {
SettingData data = new SettingData(key, emptyList(), component.orElse(null));
ImmutableList.of(validations.scope(), validations.qualifier()).forEach(validation -> validation.accept(data));
});
List<String> keys = getKeys(resetRequest);
if (component.isPresent()) {
settingsUpdater.deleteComponentSettings(dbSession, component.get(), keys);
} else {
settingsUpdater.deleteGlobalSettings(dbSession, keys);
}
dbSession.commit();
response.noContent();
}
}
use of org.sonar.server.setting.ws.SettingValidations.SettingData in project sonarqube by SonarSource.
the class SetAction method commonChecks.
private void commonChecks(SetRequest request, Optional<ComponentDto> component) {
checkValueIsSet(request);
SettingData settingData = new SettingData(request.getKey(), valuesFromRequest(request), component.orElse(null));
ImmutableList.of(validations.scope(), validations.qualifier(), validations.valueType()).forEach(validation -> validation.accept(settingData));
}
Aggregations