diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-05-02 15:32:18 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-05-03 14:26:30 +0200 |
commit | 116d1f01a872b83be5aedf8a700be10556c091d8 (patch) | |
tree | f75acdd421ba8132148d310ecf3919d1e2085d0e /sonar-db | |
parent | ab11abedca88572cc27e4d40a710b7a7aed986ea (diff) | |
download | sonarqube-116d1f01a872b83be5aedf8a700be10556c091d8.tar.gz sonarqube-116d1f01a872b83be5aedf8a700be10556c091d8.zip |
SONAR-7394 Fix update of custom rule active parameters
Diffstat (limited to 'sonar-db')
-rw-r--r-- | sonar-db/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java | 6 | ||||
-rw-r--r-- | sonar-db/src/main/java/org/sonar/db/qualityprofile/ActiveRuleParamDtoFunctions.java | 40 |
2 files changed, 45 insertions, 1 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java b/sonar-db/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java index fd9db72143b..07bf2d770d6 100644 --- a/sonar-db/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java +++ b/sonar-db/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java @@ -150,7 +150,11 @@ public class ActiveRuleDao implements Dao { public void deleteParam(DbSession session, ActiveRuleDto activeRule, ActiveRuleParamDto activeRuleParam) { Preconditions.checkNotNull(activeRule.getId(), ACTIVE_RULE_IS_NOT_PERSISTED); Preconditions.checkNotNull(activeRuleParam.getId(), ACTIVE_RULE_PARAM_IS_NOT_PERSISTED); - mapper(session).deleteParameter(activeRuleParam.getId()); + deleteParamById(session, activeRuleParam.getId()); + } + + public void deleteParamById(DbSession session, int id){ + mapper(session).deleteParameter(id); } public void deleteParamByKeyAndName(DbSession session, ActiveRuleKey key, String param) { diff --git a/sonar-db/src/main/java/org/sonar/db/qualityprofile/ActiveRuleParamDtoFunctions.java b/sonar-db/src/main/java/org/sonar/db/qualityprofile/ActiveRuleParamDtoFunctions.java new file mode 100644 index 00000000000..b77279ea656 --- /dev/null +++ b/sonar-db/src/main/java/org/sonar/db/qualityprofile/ActiveRuleParamDtoFunctions.java @@ -0,0 +1,40 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.db.qualityprofile; + +import com.google.common.base.Function; +import javax.annotation.Nonnull; + +public class ActiveRuleParamDtoFunctions { + + private ActiveRuleParamDtoFunctions() { + // Only static methods + } + + public enum ActiveRuleDtoParamToKey implements Function<ActiveRuleParamDto, String> { + INSTANCE; + + @Override + public String apply(@Nonnull ActiveRuleParamDto input) { + return input.getKey(); + } + } + +} |