aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/main
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2012-01-18 16:45:45 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2012-01-18 17:22:27 +0100
commit820af8847bfd362e2245efd3d15d8a5bee818920 (patch)
tree72615ff663f3b691d98c035bbc573ba865250f18 /sonar-batch/src/main
parent808360559dc1349d59363fc89b468345e5a26fc9 (diff)
downloadsonarqube-820af8847bfd362e2245efd3d15d8a5bee818920.tar.gz
sonarqube-820af8847bfd362e2245efd3d15d8a5bee818920.zip
SONAR-1707 Add the column SNAPSHOTS.BUILD_DATE
Diffstat (limited to 'sonar-batch/src/main')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java3
2 files changed, 5 insertions, 0 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java b/sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java
index e3269f58e35..749e3b36de8 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/components/TimeMachineConfiguration.java
@@ -34,6 +34,7 @@ import org.sonar.batch.components.PastSnapshot;
import org.sonar.batch.components.PastSnapshotFinder;
import javax.persistence.Query;
+import java.util.Date;
import java.util.List;
public class TimeMachineConfiguration implements BatchExtension {
@@ -79,6 +80,7 @@ public class TimeMachineConfiguration implements BatchExtension {
snapshot = new Snapshot();
snapshot.setResourceId(projectId.intValue());
snapshot.setCreatedAt(project.getAnalysisDate());
+ snapshot.setBuildDate(new Date());
}
return snapshot;
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java
index e76b9730566..2c73b5750f3 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultResourcePersister.java
@@ -30,6 +30,7 @@ import org.sonar.api.utils.SonarException;
import javax.persistence.NonUniqueResultException;
import javax.persistence.Query;
+import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -78,6 +79,7 @@ public final class DefaultResourcePersister implements ResourcePersister {
Snapshot snapshot = new Snapshot(model, parentSnapshot);
snapshot.setVersion(project.getAnalysisVersion());
snapshot.setCreatedAt(project.getAnalysisDate());
+ snapshot.setBuildDate(new Date());
snapshot = session.save(snapshot);
session.commit();
return snapshot;
@@ -144,6 +146,7 @@ public final class DefaultResourcePersister implements ResourcePersister {
if (snapshot == null) {
snapshot = new Snapshot(model, null);
snapshot.setCreatedAt(project.getAnalysisDate());
+ snapshot.setBuildDate(new Date());
snapshot.setVersion(library.getVersion());
snapshot.setStatus(Snapshot.STATUS_PROCESSED);