diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-03-06 12:15:15 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-03-06 12:15:22 +0100 |
commit | 94ed63a7c64ddebf9056604535e4439a82ceecae (patch) | |
tree | b8a2bb09bc2fe2653e80f8dda358da0795e8a176 /sonar-ws-client/src/main/java | |
parent | 975dacb594135e449c621d254081f6e179ec51c3 (diff) | |
download | sonarqube-94ed63a7c64ddebf9056604535e4439a82ceecae.tar.gz sonarqube-94ed63a7c64ddebf9056604535e4439a82ceecae.zip |
SONAR-5056 Create new Durations API to format Duration and convert String to Duration
Diffstat (limited to 'sonar-ws-client/src/main/java')
5 files changed, 5 insertions, 105 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issue.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issue.java index 5f0c825ca50..fe396834f22 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issue.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/Issue.java @@ -55,7 +55,7 @@ public interface Issue { Double effortToFix(); @CheckForNull - WorkDayDuration technicalDebt(); + String debt(); String status(); diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/WorkDayDuration.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/WorkDayDuration.java deleted file mode 100644 index 1db322bf5e3..00000000000 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/WorkDayDuration.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.wsclient.issue; - -/** - * @since 4.0 - */ -public interface WorkDayDuration { - - Integer days(); - - Integer minutes(); - - Integer hours(); - -} diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssue.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssue.java index 75c1d776925..cbe7005e074 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssue.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssue.java @@ -21,7 +21,6 @@ package org.sonar.wsclient.issue.internal; import org.sonar.wsclient.issue.Issue; import org.sonar.wsclient.issue.IssueComment; -import org.sonar.wsclient.issue.WorkDayDuration; import org.sonar.wsclient.unmarshallers.JsonUtils; import javax.annotation.CheckForNull; @@ -82,12 +81,8 @@ public class DefaultIssue implements Issue { } @CheckForNull - public WorkDayDuration technicalDebt() { - Map technicalDebt = (Map) json.get("technicalDebt"); - if (technicalDebt != null) { - return new DefaultWorkDayDuration(technicalDebt); - } - return null; + public String debt() { + return JsonUtils.getString(json, "debt"); } public String status() { @@ -147,7 +142,7 @@ public class DefaultIssue implements Issue { } public Map<String, String> attributes() { - Map<String, String> attr = (Map<String,String>) json.get("attr"); + Map<String, String> attr = (Map<String, String>) json.get("attr"); if (attr == null) { return Collections.emptyMap(); } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueChangeDiff.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueChangeDiff.java index 289d3dd62e4..e357076fa1b 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueChangeDiff.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultIssueChangeDiff.java @@ -53,19 +53,7 @@ public class DefaultIssueChangeDiff implements IssueChangeDiff { } private Object parseValue(String attribute) { - if ("technicalDebt".equals(key())) { - return parseDefaultTechnicalDebt(attribute); - } else { - return JsonUtils.getString(json, attribute); - } - } - - private DefaultWorkDayDuration parseDefaultTechnicalDebt(String attribute){ - Map technicalDebt = (Map) json.get(attribute); - if (technicalDebt != null) { - return new DefaultWorkDayDuration(technicalDebt); - } - return null; + return JsonUtils.getString(json, attribute); } } diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultWorkDayDuration.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultWorkDayDuration.java deleted file mode 100644 index 7e2ecc79091..00000000000 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/issue/internal/DefaultWorkDayDuration.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube, open source software quality management tool. - * Copyright (C) 2008-2013 SonarSource - * mailto:contact AT sonarsource DOT com - * - * SonarQube is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * SonarQube is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.wsclient.issue.internal; - -import org.sonar.wsclient.issue.WorkDayDuration; -import org.sonar.wsclient.unmarshallers.JsonUtils; - -import java.util.Map; - -/** - * @since 4.0 - */ -public class DefaultWorkDayDuration implements WorkDayDuration { - - private final Map json; - - DefaultWorkDayDuration(Map json) { - this.json = json; - } - - public Integer days() { - return JsonUtils.getInteger(json, "days"); - } - - public Integer hours() { - return JsonUtils.getInteger(json, "hours"); - } - - public Integer minutes() { - return JsonUtils.getInteger(json, "minutes"); - } - -} |