aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/rules/Rule.java33
1 files changed, 28 insertions, 5 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 a8592b81a22..63cb14defff 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
@@ -107,8 +107,8 @@ public class Rule {
private String pluginName;
@Enumerated(EnumType.STRING)
- @Column(name = "cardinality", updatable = true, nullable = false)
- private Cardinality cardinality = Cardinality.SINGLE;
+ @Column(name = "is_template", updatable = true, nullable = false)
+ private boolean isTemplate = false;
@Column(name = "status", updatable = true, nullable = true)
private String status = STATUS_READY;
@@ -351,12 +351,35 @@ public class Rule {
return setRepositoryKey(repositoryKey).setKey(key).setConfigKey(key);
}
+ /**
+ * @since 4.4
+ */
+ public boolean isTemplate() {
+ return isTemplate;
+ }
+
+ /**
+ * @since 4.4
+ */
+ public Rule setIsTemplate(boolean isTemplate) {
+ this.isTemplate = isTemplate;
+ return this;
+ }
+
+ /**
+ * @deprecated since 4.4, use {@link #isTemplate()}
+ */
+ @Deprecated
public Cardinality getCardinality() {
- return cardinality;
+ return isTemplate ? Cardinality.MULTIPLE : Cardinality.SINGLE;
}
+ /**
+ * @deprecated since 4.4, use {@link #setIsTemplate(boolean)}
+ */
+ @Deprecated
public Rule setCardinality(Cardinality c) {
- this.cardinality = c;
+ this.isTemplate = Cardinality.MULTIPLE.equals(c);
return this;
}
@@ -544,7 +567,7 @@ public class Rule {
.append("configKey", configKey)
.append("plugin", pluginName)
.append("severity", priority)
- .append("cardinality", cardinality)
+ .append("isTemplate", isTemplate())
.append("status", status)
.append("language", language)
.append("template", template)