]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5007 - Added parentKey to QualityProfileDto
authorStephane Gamard <stephane.gamard@searchbox.com>
Thu, 22 May 2014 16:50:31 +0000 (18:50 +0200)
committerStephane Gamard <stephane.gamard@searchbox.com>
Thu, 22 May 2014 17:11:40 +0000 (19:11 +0200)
sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDto.java
sonar-server/src/main/java/org/sonar/server/rule2/ws/AppAction.java

index cdf29be0e56f92ac079cc6ceb71b92a0aa22575c..1b6e7aed729549a5dd4ecac6e3cbbf2e546b22a7 100644 (file)
@@ -79,6 +79,16 @@ public class QualityProfileDto extends Dto<QualityProfileKey> {
     return parent;
   }
 
+  @CheckForNull
+  public QualityProfileKey getParentKey() {
+    if(getParent() != null && !getParent().isEmpty()) {
+      return QualityProfileKey.of(this.getParent(), this.getLanguage());
+    } else {
+      return null;
+    }
+  }
+
+
   public QualityProfileDto setParent(@Nullable String parent) {
     this.parent = parent;
     return this;
index 58b55f9bfb838e30b4d55247caf5fe22445ef0ef..1dcedacb5057b90aff8de88856d7b931683a2cb3 100644 (file)
@@ -175,6 +175,7 @@ public class AppAction implements RequestHandler {
         .prop("name", profile.getName())
         .prop("lang", profile.getLanguage())
         .prop("parent", profile.getParent())
+        .prop("parentKey", profile.getParentKey().toString())
         .endObject();
     }
     json.endArray();