use of org.sonar.server.rule.RuleUpdate in project sonarqube by SonarSource.
the class UpdateAction method readRequest.
private RuleUpdate readRequest(DbSession dbSession, Request request) {
RuleKey key = RuleKey.parse(request.mandatoryParam(PARAM_KEY));
RuleUpdate update = createRuleUpdate(dbSession, key);
readTags(request, update);
readMarkdownNote(request, update);
readDebt(request, update);
String name = request.param(PARAM_NAME);
if (name != null) {
update.setName(name);
}
String description = request.param(PARAM_DESCRIPTION);
if (description != null) {
update.setMarkdownDescription(description);
}
String severity = request.param(PARAM_SEVERITY);
if (severity != null) {
update.setSeverity(severity);
}
String status = request.param(PARAM_STATUS);
if (status != null) {
update.setStatus(RuleStatus.valueOf(status));
}
String params = request.param(PARAMS);
if (params != null) {
update.setParameters(KeyValueFormat.parse(params));
}
return update;
}
use of org.sonar.server.rule.RuleUpdate in project sonarqube by SonarSource.
the class UpdateAction method handle.
@Override
public void handle(Request request, Response response) throws Exception {
ruleWsSupport.checkQProfileAdminPermission();
try (DbSession dbSession = dbClient.openSession(false)) {
RuleUpdate update = readRequest(dbSession, request);
ruleUpdater.update(dbSession, update, userSession);
UpdateResponse updateResponse = buildResponse(dbSession, update.getRuleKey());
writeProtobuf(updateResponse, request, response);
}
}
Aggregations