diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-06-12 11:58:29 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-06-12 11:58:29 +0200 |
commit | 5105c84b6310750a73e5ad46ac0fda03e35b0720 (patch) | |
tree | 5b45d6cf5caf0edf72d4d95b94d634895cc8a824 /sonar-plugin-api | |
parent | 0ebe203200cd2ff3778a61887e5e552c4d542854 (diff) | |
download | sonarqube-5105c84b6310750a73e5ad46ac0fda03e35b0720.tar.gz sonarqube-5105c84b6310750a73e5ad46ac0fda03e35b0720.zip |
SONAR-5351 Create a migration to replace rules.parent_id to rules.template_id
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r-- | sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java index 402a5ec9f9d..a8592b81a22 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java @@ -34,19 +34,7 @@ import org.sonar.check.Cardinality; import javax.annotation.CheckForNull; import javax.annotation.Nullable; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; +import javax.persistence.*; import java.util.ArrayList; import java.util.Date; @@ -129,8 +117,8 @@ public class Rule { private String language; @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = "parent_id", updatable = true, nullable = true) - private Rule parent = null; + @JoinColumn(name = "template_id", updatable = true, nullable = true) + private Rule template = null; @Column(name = "characteristic_id", updatable = true, nullable = true) private Integer characteristicId; @@ -372,12 +360,35 @@ public class Rule { return this; } + /** + * @deprecated since 4.4, use {@link #getTemplate()} + */ + @Deprecated public Rule getParent() { - return parent; + return template; } + /** + * @deprecated since 4.4, use {@link #setTemplate(Rule)}} + */ + @Deprecated public Rule setParent(Rule parent) { - this.parent = parent; + this.template = parent; + return this; + } + + /** + * @since 4.4 + */ + public Rule getTemplate() { + return template; + } + + /** + * @since 4.4 + */ + public Rule setTemplate(Rule template) { + this.template = template; return this; } @@ -536,7 +547,7 @@ public class Rule { .append("cardinality", cardinality) .append("status", status) .append("language", language) - .append("parent", parent) + .append("template", template) .toString(); } |