aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch-protocol/src/main
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-11-03 11:07:31 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2014-11-03 11:55:30 +0100
commit89eede7717dd056d314a214afb64a17be98fbc0e (patch)
tree3c9ed05a9749ea9a9557a2bb9a88b988f6ab26b1 /sonar-batch-protocol/src/main
parent19a6905ce6c877f1497b2ce47b7aeb478591b036 (diff)
downloadsonarqube-89eede7717dd056d314a214afb64a17be98fbc0e.tar.gz
sonarqube-89eede7717dd056d314a214afb64a17be98fbc0e.zip
SONAR-5815 Store last update time on source data
Diffstat (limited to 'sonar-batch-protocol/src/main')
-rw-r--r--sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ProjectReferentials.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ProjectReferentials.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ProjectReferentials.java
index d967e933de4..68d06e73b48 100644
--- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ProjectReferentials.java
+++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ProjectReferentials.java
@@ -20,12 +20,15 @@
package org.sonar.batch.protocol.input;
import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -40,6 +43,7 @@ public class ProjectReferentials {
private Collection<ActiveRule> activeRules = new ArrayList<ActiveRule>();
private Map<String, Map<String, String>> settingsByModule = new HashMap<String, Map<String, String>>();
private Map<String, Map<String, FileData>> fileDataByModuleAndPath = new HashMap<String, Map<String, FileData>>();
+ private Date lastAnalysisDate;
public Map<String, String> settings(String projectKey) {
return settingsByModule.containsKey(projectKey) ? settingsByModule.get(projectKey) : Collections.<String, String>emptyMap();
@@ -100,12 +104,23 @@ public class ProjectReferentials {
this.timestamp = timestamp;
}
+ @CheckForNull
+ public Date lastAnalysisDate() {
+ return lastAnalysisDate;
+ }
+
+ public void setLastAnalysisDate(@Nullable Date lastAnalysisDate) {
+ this.lastAnalysisDate = lastAnalysisDate;
+ }
+
public String toJson() {
- return new Gson().toJson(this);
+ Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").create();
+ return gson.toJson(this);
}
public static ProjectReferentials fromJson(String json) {
- return new Gson().fromJson(json, ProjectReferentials.class);
+ Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").create();
+ return gson.fromJson(json, ProjectReferentials.class);
}
}