diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-02-06 16:34:43 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-02-06 16:35:19 +0100 |
commit | e3b0bdaa3133ebe84fe46b5c19ab11b8d558a977 (patch) | |
tree | f58e45bc103f6a099eead479f4a49e5a42360019 /sonar-plugin-api/src | |
parent | 7695be13eef827246b5eb87f7d11f8c1923c7842 (diff) | |
download | sonarqube-e3b0bdaa3133ebe84fe46b5c19ab11b8d558a977.tar.gz sonarqube-e3b0bdaa3133ebe84fe46b5c19ab11b8d558a977.zip |
SONAR-5183 timezones - restore Snapshot API
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java index 2a3a9972653..a83d19fd29b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/Snapshot.java @@ -714,6 +714,30 @@ public class Snapshot extends BaseIdentifiable<Snapshot> implements Serializable * * @since 2.5 */ + public Snapshot setPeriodDate(int periodIndex, Date date) { + Long time = dateToLong(date); + switch (periodIndex) { + case 1: + period1Date = time; + break; + case 2: + period2Date = time; + break; + case 3: + period3Date = time; + break; + case 4: + period4Date = time; + break; + case 5: + period5Date = time; + break; + default: + throw new IndexOutOfBoundsException("Index of Snapshot.periodDate is between 1 and 5"); + } + return this; + } + public Snapshot setPeriodDateMs(int periodIndex, Long date) { switch (periodIndex) { case 1: @@ -737,7 +761,24 @@ public class Snapshot extends BaseIdentifiable<Snapshot> implements Serializable return this; } - public Long getPeriodDate(int periodIndex) { + public Date getPeriodDate(int periodIndex) { + switch (periodIndex) { + case 1: + return longToDate(period1Date); + case 2: + return longToDate(period2Date); + case 3: + return longToDate(period3Date); + case 4: + return longToDate(period4Date); + case 5: + return longToDate(period5Date); + default: + throw new IndexOutOfBoundsException("Index of Snapshot.periodDate is between 1 and 5"); + } + } + + public Long getPeriodDateMs(int periodIndex) { switch (periodIndex) { case 1: return period1Date; |