aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@searchbox.com>2014-05-10 14:01:10 +0200
committerStephane Gamard <stephane.gamard@searchbox.com>2014-05-10 14:01:10 +0200
commit1d279fde85bd61a7aeb7c119fe9c1784272402d6 (patch)
treefa7a32c5d4372736dc0ee0e68d905c0d1738a317 /sonar-server
parent26fea41b7b16997059cba8d90623814bfbd7ff83 (diff)
downloadsonarqube-1d279fde85bd61a7aeb7c119fe9c1784272402d6.tar.gz
sonarqube-1d279fde85bd61a7aeb7c119fe9c1784272402d6.zip
Added missing dao methods for Bootstrap services
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule2/ActiveRuleDao.java30
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule2/RuleDao.java5
2 files changed, 34 insertions, 1 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/rule2/ActiveRuleDao.java b/sonar-server/src/main/java/org/sonar/server/rule2/ActiveRuleDao.java
index 3c6b956a768..1ce607b6f6f 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule2/ActiveRuleDao.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule2/ActiveRuleDao.java
@@ -51,6 +51,11 @@ public class ActiveRuleDao extends BaseDao<ActiveRuleMapper, ActiveRuleDto, Acti
throw new UnsupportedOperationException("Need to implement ActiveRuleDto.doGetByKey() method");
}
+ @Deprecated
+ public ActiveRuleDto getById(int activeRuleId, DbSession session) {
+ return mapper(session).selectById(activeRuleId);
+ }
+
@Override
protected ActiveRuleDto doGetByKey(ActiveRuleKey key, DbSession session) {
QualityProfileDto qDto = profileDao.selectByNameAndLanguage(key.qProfile().name(), key.qProfile().lang(), session);
@@ -82,7 +87,7 @@ public class ActiveRuleDao extends BaseDao<ActiveRuleMapper, ActiveRuleDto, Acti
}
public List<ActiveRuleParamDto> findParamsByActiveRule(ActiveRuleDto dto, DbSession session) {
- Preconditions.checkArgument(dto.getId()!=null, "ActiveRule is not persisted");
+ Preconditions.checkArgument(dto.getId() != null, "ActiveRule is not persisted");
return mapper(session).selectParamsByActiveRuleId(dto.getId());
}
@@ -101,4 +106,27 @@ public class ActiveRuleDao extends BaseDao<ActiveRuleMapper, ActiveRuleDto, Acti
Preconditions.checkArgument(rule.getId()!=null, "Rule is not persisted");
return mapper(dbSession).selectByRuleId(rule.getId());
}
+
+ public void removeAllParam(ActiveRuleDto activeRule, DbSession session) {
+ Preconditions.checkArgument(activeRule.getId()!=null, "ActiveRule is not persisted");
+ mapper(session).deleteParameters(activeRule.getId());
+ }
+
+ public void removeParam(ActiveRuleDto activeRule, ActiveRuleParamDto activeRuleParam, DbSession session) {
+ Preconditions.checkArgument(activeRule.getId()!=null, "ActiveRule is not persisted");
+ Preconditions.checkArgument(activeRuleParam.getId()!=null, "ActiveRuleParam is not persisted");
+ mapper(session).deleteParameter(activeRuleParam.getId());
+ }
+
+ public void updateParam(ActiveRuleDto activeRule, ActiveRuleParamDto activeRuleParam, DbSession session) {
+ Preconditions.checkArgument(activeRule.getId()!=null, "ActiveRule is not persisted");
+ Preconditions.checkArgument(activeRuleParam.getId()!=null, "ActiveRuleParam is not persisted");
+ mapper(session).updateParameter(activeRuleParam);
+ }
+
+ public ActiveRuleParamDto getParamsByActiveRuleAndKey(ActiveRuleDto activeRule, String key, DbSession session) {
+ Preconditions.checkArgument(activeRule.getId()!=null, "ActiveRule is not persisted");
+ Preconditions.checkArgument(key!=null, "Param key cannot be null");
+ return mapper(session).selectParamByActiveRuleAndKey(activeRule.getId(), key);
+ }
}
diff --git a/sonar-server/src/main/java/org/sonar/server/rule2/RuleDao.java b/sonar-server/src/main/java/org/sonar/server/rule2/RuleDao.java
index e1b426d976e..96bea1ed13b 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule2/RuleDao.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule2/RuleDao.java
@@ -157,4 +157,9 @@ public class RuleDao extends BaseDao<RuleMapper, RuleDto, RuleKey> implements Ba
}
return ruleParamDtos;
}
+
+ public RuleParamDto getRuleParamByRuleAndParamKey(RuleDto rule, String key, DbSession session) {
+ Preconditions.checkNotNull(rule.getId(), "Rule is not persisted");
+ return mapper(session).selectParamByRuleAndKey(rule.getId(), key);
+ }
}