aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-core/src/main
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-11-26 06:56:17 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-11-26 06:56:17 +0000
commit19f841e8c13c6dc8ef2f6a68a5751fa5fba26062 (patch)
tree9d49148613eb125d28d69984ee76331f867b18c5 /sonar-core/src/main
parent0b63c5a59ac2f160c5c7bc35d7f423f2a944e8ac (diff)
downloadsonarqube-19f841e8c13c6dc8ef2f6a68a5751fa5fba26062.tar.gz
sonarqube-19f841e8c13c6dc8ef2f6a68a5751fa5fba26062.zip
SONAR-249: extract persistence layer from data index + dump measures at the end of the batch instead of persisting them on the fly
Diffstat (limited to 'sonar-core/src/main')
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresDao.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresService.java10
2 files changed, 6 insertions, 6 deletions
diff --git a/sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresDao.java b/sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresDao.java
index 4e2ece885ab..4c8c71b0b72 100644
--- a/sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresDao.java
+++ b/sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresDao.java
@@ -131,7 +131,7 @@ public class AsyncMeasuresDao extends BaseDao {
"AND ams.snapshotDate>=:measureDate " +
"ORDER BY ams.snapshotDate ASC ")
.setParameter("projectId", asyncMeasure.getProjectId())
- .setParameter("metricId", asyncMeasure.getMetric().getId())
+ .setParameter("metricId", asyncMeasure.getMetricId())
.setParameter("measureDate", asyncMeasure.getMeasureDate());
if (endDate != null) {
query.setParameter("endDate", endDate);
diff --git a/sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresService.java b/sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresService.java
index ae296d1e356..26b1926b901 100644
--- a/sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresService.java
+++ b/sonar-core/src/main/java/org/sonar/jpa/dao/AsyncMeasuresService.java
@@ -90,7 +90,7 @@ public class AsyncMeasuresService {
AsyncMeasuresDao dao = new AsyncMeasuresDao(session);
MeasureModel measure = dao.getAsyncMeasure(id);
AsyncMeasureSnapshot pastAsyncMeasureSnapshot = dao.getLastAsyncMeasureSnapshot(measure.getProjectId(),
- measure.getMetric().getId(), measure.getMeasureDate());
+ measure.getMetricId(), measure.getMeasureDate());
dao.deleteAsyncMeasure(measure);
if (pastAsyncMeasureSnapshot != null) {
MeasureModel pastAsyncMeasure = dao.getAsyncMeasure(pastAsyncMeasureSnapshot.getMeasureId());
@@ -102,7 +102,7 @@ public class AsyncMeasuresService {
private void registerMeasure(MeasureModel measure, AsyncMeasuresDao dao) {
AsyncMeasureSnapshot nextAsyncMeasureSnapshot = dao.getNextAsyncMeasureSnapshot(
- measure.getProjectId(), measure.getMetric().getId(), measure.getMeasureDate());
+ measure.getProjectId(), measure.getMetricId(), measure.getMeasureDate());
Date dateNextAsyncMeasure = (nextAsyncMeasureSnapshot != null) ? nextAsyncMeasureSnapshot.getMeasureDate() : null;
List<AsyncMeasureSnapshot> nextAsyncMeasureSnapshots = dao.getNextAsyncMeasureSnapshotsUntilDate(
@@ -110,7 +110,7 @@ public class AsyncMeasuresService {
if (!nextAsyncMeasureSnapshots.isEmpty()) {
for (AsyncMeasureSnapshot asyncMeasureSnapshot : nextAsyncMeasureSnapshots) {
dao.createAsyncMeasureSnapshot(measure.getId(), asyncMeasureSnapshot.getSnapshotId(), measure.getMeasureDate(),
- asyncMeasureSnapshot.getSnapshotDate(), measure.getMetric().getId(), measure.getProjectId());
+ asyncMeasureSnapshot.getSnapshotDate(), measure.getMetricId(), measure.getProjectId());
dao.removeSnapshotFromAsyncMeasureSnapshot(asyncMeasureSnapshot);
}
} else {
@@ -118,11 +118,11 @@ public class AsyncMeasuresService {
if (!nextSnapshotsUntilDate.isEmpty()) {
for (Snapshot nextSnapshot : nextSnapshotsUntilDate) {
dao.createAsyncMeasureSnapshot(measure.getId(), nextSnapshot.getId(), measure.getMeasureDate(),
- nextSnapshot.getCreatedAt(), measure.getMetric().getId(), measure.getProjectId());
+ nextSnapshot.getCreatedAt(), measure.getMetricId(), measure.getProjectId());
}
} else {
dao.createAsyncMeasureSnapshot(measure.getId(), null, measure.getMeasureDate(),
- null, measure.getMetric().getId(), measure.getProjectId());
+ null, measure.getMetricId(), measure.getProjectId());
}
}
}