aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-18 09:34:41 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-18 10:29:58 +0100
commit8c7b10b6bf2712e1d7201ebd025aed36fad7ead6 (patch)
tree9f6d5337082c13e7e3e7484cd36fd45ab7ef1d9b /sonar-plugin-api/src
parent496178d4de56ac80035f8ddf580405f4bb3dd8ec (diff)
downloadsonarqube-8c7b10b6bf2712e1d7201ebd025aed36fad7ead6.tar.gz
sonarqube-8c7b10b6bf2712e1d7201ebd025aed36fad7ead6.zip
SONAR-5056 Refactoring of DebtModelService to have a clean dedicated server side API of debt
Diffstat (limited to 'sonar-plugin-api/src')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtCharacteristic.java40
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/TechnicalDebtManager.java)17
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristic.java85
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/package-info.java24
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/server/debt/package-info.java24
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/Characteristic.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristic.java2
7 files changed, 184 insertions, 12 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtCharacteristic.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtCharacteristic.java
new file mode 100644
index 00000000000..8f3dd602d7b
--- /dev/null
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtCharacteristic.java
@@ -0,0 +1,40 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 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.api.server.debt;
+
+import javax.annotation.CheckForNull;
+
+/**
+ * @since 4.3
+ */
+public interface DebtCharacteristic {
+ Integer id();
+
+ String key();
+
+ String name();
+
+ @CheckForNull
+ Integer order();
+
+ @CheckForNull
+ Integer parentId();
+}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/TechnicalDebtManager.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java
index e3b1d8465d6..e2bd93cba6c 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/TechnicalDebtManager.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java
@@ -18,26 +18,21 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package org.sonar.api.technicaldebt.server;
+package org.sonar.api.server.debt;
import org.sonar.api.ServerComponent;
-import org.sonar.api.rules.Rule;
import java.util.List;
/**
- * @since 4.1
+ * @since 4.3
*/
+public interface DebtModel extends ServerComponent {
-public interface TechnicalDebtManager extends ServerComponent {
+ List<DebtCharacteristic> characteristics();
- List<Characteristic> findRootCharacteristics();
+ List<DebtCharacteristic> rootCharacteristics();
- /**
- * @deprecated since 4.3. Always return null
- */
- @Deprecated
- Characteristic findRequirementByRule(Rule rule);
+ DebtCharacteristic characteristicById(int id);
- Characteristic findCharacteristicById(Integer id);
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristic.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristic.java
new file mode 100644
index 00000000000..6b6fce040f5
--- /dev/null
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/DefaultDebtCharacteristic.java
@@ -0,0 +1,85 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 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.api.server.debt.internal;
+
+import org.sonar.api.server.debt.DebtCharacteristic;
+
+/**
+ * @since 4.3
+ */
+public class DefaultDebtCharacteristic implements DebtCharacteristic {
+
+ private Integer id;
+ private String key;
+ private String name;
+ private Integer order;
+ private Integer parentId;
+
+ @Override
+ public Integer id() {
+ return id;
+ }
+
+ public DefaultDebtCharacteristic setId(Integer id) {
+ this.id = id;
+ return this;
+ }
+
+ @Override
+ public String key() {
+ return key;
+ }
+
+ public DefaultDebtCharacteristic setKey(String key) {
+ this.key = key;
+ return this;
+ }
+
+ @Override
+ public String name() {
+ return name;
+ }
+
+ public DefaultDebtCharacteristic setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ @Override
+ public Integer order() {
+ return order;
+ }
+
+ public DefaultDebtCharacteristic setOrder(Integer order) {
+ this.order = order;
+ return this;
+ }
+
+ @Override
+ public Integer parentId() {
+ return parentId;
+ }
+
+ public DefaultDebtCharacteristic setParentId(Integer parentId) {
+ this.parentId = parentId;
+ return this;
+ }
+}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/package-info.java
new file mode 100644
index 00000000000..fc333dadf16
--- /dev/null
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/internal/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 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.
+ */
+
+@ParametersAreNonnullByDefault
+package org.sonar.api.server.debt.internal;
+
+import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/package-info.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/package-info.java
new file mode 100644
index 00000000000..296802f21d5
--- /dev/null
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/package-info.java
@@ -0,0 +1,24 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 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.
+ */
+
+@ParametersAreNonnullByDefault
+package org.sonar.api.server.debt;
+
+import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/Characteristic.java b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/Characteristic.java
index c39eba4108a..1e263a6fe20 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/Characteristic.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/Characteristic.java
@@ -27,8 +27,10 @@ import org.sonar.api.utils.internal.WorkDuration;
import javax.annotation.CheckForNull;
/**
- * @since 4.1
+ * @since 4.1 *
+ * @deprecated since 4.3.
*/
+@Deprecated
public interface Characteristic {
Integer id();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristic.java b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristic.java
index 15a0e68dfd4..1c49df8a662 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristic.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/technicaldebt/server/internal/DefaultCharacteristic.java
@@ -32,7 +32,9 @@ import javax.annotation.Nullable;
/**
* @since 4.1
+ * @deprecated since 4.3.
*/
+@Deprecated
public class DefaultCharacteristic implements Characteristic {
private Integer id;