]> source.dussan.org Git - sonarqube.git/commitdiff
Fix quality flaws
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Mon, 12 Jan 2015 16:54:23 +0000 (17:54 +0100)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Mon, 12 Jan 2015 16:54:27 +0000 (17:54 +0100)
server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndex.java
server/sonar-server/src/main/java/org/sonar/server/rule/ws/SearchAction.java

index f056364cf47651f65e057abd8307b13b853b1dcb..bdfca485496cc93e12af9f964588434cf18dbf99 100644 (file)
@@ -339,18 +339,25 @@ public class RuleIndex extends BaseIndex<Rule, RuleDto, RuleKey> {
 
     StickyFacetBuilder stickyFacetBuilder = stickyFacetBuilder(queryBuilder, filters);
     if (options.facets().contains("languages") || options.facets().contains("true")) {
-      aggregations.put(FACET_LANGUAGES, // + "global",
-        stickyFacetBuilder.buildStickyFacet(RuleNormalizer.RuleField.LANGUAGE.field(), FACET_LANGUAGES, query.getLanguages() == null ? new String[0] : query.getLanguages().toArray()));
+      Collection<String> languages = query.getLanguages();
+      aggregations.put(FACET_LANGUAGES,
+        stickyFacetBuilder.buildStickyFacet(RuleNormalizer.RuleField.LANGUAGE.field(), FACET_LANGUAGES,
+          languages == null ? new String[0] : languages.toArray()));
     }
     if (options.facets().contains("tags") || options.facets().contains("true")) {
-      aggregations.put(FACET_TAGS, // + "global",
-        stickyFacetBuilder.buildStickyFacet(RuleNormalizer.RuleField.ALL_TAGS.field(), FACET_TAGS, query.getTags() == null ? new String[0] : query.getTags().toArray()));
+      Collection<String> tags = query.getTags();
+      aggregations.put(FACET_TAGS,
+        stickyFacetBuilder.buildStickyFacet(RuleNormalizer.RuleField.ALL_TAGS.field(), FACET_TAGS,
+          tags == null ? new String[0] : tags.toArray()));
     }
     if (options.facets().contains("repositories") || options.facets().contains("true")) {
-      aggregations.put(FACET_REPOSITORIES, // + "global",
-        stickyFacetBuilder.buildStickyFacet(RuleNormalizer.RuleField.REPOSITORY.field(), FACET_REPOSITORIES, query.getRepositories() == null ? new String[0] : query.getRepositories().toArray()));
+      Collection<String> repositories = query.getRepositories();
+      aggregations.put(FACET_REPOSITORIES,
+        stickyFacetBuilder.buildStickyFacet(RuleNormalizer.RuleField.REPOSITORY.field(), FACET_REPOSITORIES,
+          repositories == null ? new String[0] : repositories.toArray()));
     }
 
+
     return aggregations;
 
   }
index 89cd40c61fe67dfb533092e2f26f39eed7cc5045..6dd6f9890ac8a1063f0a5a9bc94a480c9c9dbb35 100644 (file)
@@ -67,7 +67,7 @@ public class SearchAction extends SearchRequestHandler<RuleQuery, Rule> {
 
   public static final String SEARCH_ACTION = "search";
 
-  private static final Collection<String> DEFAULT_FACETS = ImmutableSet.of("languages", "repositories", "tags");
+  private static final Collection<String> DEFAULT_FACETS = ImmutableSet.of(PARAM_LANGUAGES, PARAM_REPOSITORIES, "tags");
 
   private final RuleService ruleService;
   private final ActiveRuleCompleter activeRuleCompleter;
@@ -95,8 +95,8 @@ public class SearchAction extends SearchRequestHandler<RuleQuery, Rule> {
   @CheckForNull
   protected Collection<String> possibleFacets() {
     return Arrays.asList(new String[] {
-      "languages",
-      "repositories",
+      PARAM_LANGUAGES,
+      PARAM_REPOSITORIES,
       "tags",
       "characteristics",
       "severities",