aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-server/src
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-07-23 16:26:56 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-07-24 09:22:46 +0200
commit9d67df67f33fb8f293fa52641d3f6114b9a936c8 (patch)
tree9abdb04b44917364872a4c98bf9a2b27c4215afa /server/sonar-server/src
parent2a5d7c1a948efa94203a93592c8137b63fc4757b (diff)
downloadsonarqube-9d67df67f33fb8f293fa52641d3f6114b9a936c8.tar.gz
sonarqube-9d67df67f33fb8f293fa52641d3f6114b9a936c8.zip
Rename MetricDao methods following the new convention
Diffstat (limited to 'server/sonar-server/src')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/UpdateAction.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/metric/DefaultMetricFinder.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/metric/ws/UpdateAction.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/metric/ws/UpdateActionTest.java4
5 files changed, 6 insertions, 6 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java
index 7fb1fc44f99..a55b37b381a 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java
@@ -159,7 +159,7 @@ public class CreateAction implements CustomMeasuresWsAction {
checkArgument(metricId != null ^ metricKey != null, "The metric id or the metric key must be provided, not both.");
if (metricId != null) {
- return dbClient.metricDao().selectById(dbSession, metricId);
+ return dbClient.metricDao().selectOrFailById(dbSession, metricId);
}
return dbClient.metricDao().selectOrFailByKey(dbSession, metricKey);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/UpdateAction.java b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/UpdateAction.java
index b9c15ea2f09..6fcaa248631 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/UpdateAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/UpdateAction.java
@@ -94,7 +94,7 @@ public class UpdateAction implements CustomMeasuresWsAction {
DbSession dbSession = dbClient.openSession(true);
try {
CustomMeasureDto customMeasure = dbClient.customMeasureDao().selectOrFail(dbSession, id);
- MetricDto metric = dbClient.metricDao().selectById(dbSession, customMeasure.getMetricId());
+ MetricDto metric = dbClient.metricDao().selectOrFailById(dbSession, customMeasure.getMetricId());
ComponentDto component = dbClient.componentDao().selectOrFailByUuid(dbSession, customMeasure.getComponentUuid());
checkPermissions(userSession, component);
User user = userIndex.getByLogin(userSession.getLogin());
diff --git a/server/sonar-server/src/main/java/org/sonar/server/metric/DefaultMetricFinder.java b/server/sonar-server/src/main/java/org/sonar/server/metric/DefaultMetricFinder.java
index e6eb24eb131..de2b0e5ce2a 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/metric/DefaultMetricFinder.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/metric/DefaultMetricFinder.java
@@ -46,7 +46,7 @@ public class DefaultMetricFinder implements MetricFinder {
public Metric findById(int id) {
DbSession session = dbClient.openSession(false);
try {
- MetricDto dto = dbClient.metricDao().selectNullableById(session, id);
+ MetricDto dto = dbClient.metricDao().selectById(session, id);
if (dto != null && dto.isEnabled()) {
return ToMetric.INSTANCE.apply(dto);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/metric/ws/UpdateAction.java b/server/sonar-server/src/main/java/org/sonar/server/metric/ws/UpdateAction.java
index ce27a51a3b2..5ca92eca9dc 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/metric/ws/UpdateAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/metric/ws/UpdateAction.java
@@ -107,7 +107,7 @@ public class UpdateAction implements MetricsWsAction {
DbSession dbSession = dbClient.openSession(false);
try {
MetricDto metricTemplate = newMetricTemplate(request);
- MetricDto metricInDb = dbClient.metricDao().selectNullableById(dbSession, id);
+ MetricDto metricInDb = dbClient.metricDao().selectById(dbSession, id);
checkMetricInDbAndTemplate(dbSession, metricInDb, metricTemplate);
updateMetricInDb(dbSession, metricInDb, metricTemplate);
diff --git a/server/sonar-server/src/test/java/org/sonar/server/metric/ws/UpdateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/metric/ws/UpdateActionTest.java
index 0461721139d..0fb2442a859 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/metric/ws/UpdateActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/metric/ws/UpdateActionTest.java
@@ -101,7 +101,7 @@ public class UpdateActionTest {
.execute();
dbSession.commit();
- MetricDto result = dbClient.metricDao().selectNullableById(dbSession, id);
+ MetricDto result = dbClient.metricDao().selectById(dbSession, id);
assertThat(result.getKey()).isEqualTo("another-key");
assertThat(result.getShortName()).isEqualTo("another-name");
assertThat(result.getValueType()).isEqualTo(ValueType.BOOL.name());
@@ -121,7 +121,7 @@ public class UpdateActionTest {
.execute();
dbSession.commit();
- MetricDto result = dbClient.metricDao().selectNullableById(dbSession, id);
+ MetricDto result = dbClient.metricDao().selectById(dbSession, id);
assertThat(result.getKey()).isEqualTo(DEFAULT_KEY);
assertThat(result.getShortName()).isEqualTo(DEFAULT_NAME);
assertThat(result.getValueType()).isEqualTo(DEFAULT_TYPE);