diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-04-23 13:58:37 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-04-23 13:58:37 +0200 |
commit | 5846e6c2a88a0fa46d999689d9eb51ef0921ab94 (patch) | |
tree | 9bb91a8fabcabf8b547ae26c4ad44ff4a2c3cf2b /sonar-plugin-api/src/main/java | |
parent | c6f00c7d73b1b2b2c449470a74d0852ce4501244 (diff) | |
download | sonarqube-5846e6c2a88a0fa46d999689d9eb51ef0921ab94.tar.gz sonarqube-5846e6c2a88a0fa46d999689d9eb51ef0921ab94.zip |
SONAR-3755 Add methods in IssueFinder Results to get rule by issue and component by issue and remove title from Issue
Diffstat (limited to 'sonar-plugin-api/src/main/java')
4 files changed, 61 insertions, 16 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java index d842bec2d4e..57ae00e3a45 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java @@ -50,8 +50,6 @@ public interface Issue { String severity(); - String title(); - String description(); Integer line(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFinder.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFinder.java index 43837b19f7d..e3c3b5a62ce 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFinder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/IssueFinder.java @@ -21,8 +21,12 @@ package org.sonar.api.issue; import org.sonar.api.ServerComponent; +import org.sonar.api.component.Component; +import org.sonar.api.rules.Rule; import javax.annotation.Nullable; + +import java.util.Collection; import java.util.List; /** @@ -35,12 +39,21 @@ public interface IssueFinder extends ServerComponent { interface Results { List<Issue> issues(); + + Rule rule(Issue issue); + + Collection<Rule> rules(); + + Component component(Issue issue); + + Collection<Component> components(); } Results find(IssueQuery query, @Nullable Integer currentUserId, String role); Issue findByKey(String key /* TODO @Nullable Integer currentUserId */); -/* + + /* Map<RuleKey, Rule> rules(Collection<Issue> issues); Map<String, Component> components(Collection<Issue> issues); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/rule/JRubyRules.java b/sonar-plugin-api/src/main/java/org/sonar/api/rule/JRubyRules.java new file mode 100644 index 00000000000..87656e61133 --- /dev/null +++ b/sonar-plugin-api/src/main/java/org/sonar/api/rule/JRubyRules.java @@ -0,0 +1,43 @@ +/* + * 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.api.rule; + +import org.sonar.api.ServerComponent; + +/** + * Facade for JRuby on Rails extensions to request rules. + * <p> + * Reference from Ruby code : <code>Api.rules</code> + * </p> + * + * @since 3.6 + */ +public interface JRubyRules extends ServerComponent { + + /** + * Return the localized name of a rule. + * + * <p> + * Ruby: <code>Api.rules.ruleName(I18n.locale, rule.rule_key)</code> + * </p> + */ + String ruleName(String rubyLocale, RuleKey ruleKey); + +} 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 282d5b0cfb6..3a5cc176be2 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 @@ -32,19 +32,7 @@ import org.sonar.api.rule.RuleKey; import org.sonar.api.utils.SonarException; import org.sonar.check.Cardinality; -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; @@ -545,6 +533,9 @@ public final class Rule { return ImmutableSet.of(STATUS_READY, STATUS_BETA, STATUS_DEPRECATED, STATUS_REMOVED); } + /** + * @since 3.6 + */ public RuleKey ruleKey() { return RuleKey.of(getRepositoryKey(), getKey()); } |