]> source.dussan.org Git - sonarqube.git/commitdiff
Small refactoring on qprofiles/search WS and ProjectRepositoryLoader
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Tue, 8 Sep 2015 11:50:01 +0000 (13:50 +0200)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Thu, 17 Sep 2015 07:30:51 +0000 (09:30 +0200)
server/sonar-server/src/main/java/org/sonar/server/batch/ProjectRepositoryLoader.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java

index e520ecf1e078190a590698687523a39213aafe90..6d4ce4855e1edcc036f9df5f1e09b408ec6bea5b 100644 (file)
@@ -220,7 +220,7 @@ public class ProjectRepositoryLoader {
    * If no profile found, try to find the quality profile set on the project (if provided)
    * If still no profile found, try to find the default profile of the language
    * <p/>
-   * Never return null because a default profile should always be set on ech language
+   * Never return null because a default profile should always be set on each language
    */
   private QualityProfileDto getProfile(String languageKey, @Nullable String projectKey, @Nullable String profileName, DbSession session) {
     QualityProfileDto qualityProfileDto = profileName != null ? qProfileFactory.getByNameAndLanguage(session, profileName, languageKey) : null;
index f9927daa8d1b78a1b119be745d9e2a607e1757a4..e6dead6ed070aae07b01f63cca67f1b9f5fd59ef 100644 (file)
@@ -64,11 +64,8 @@ public class SearchAction implements QProfileWsAction {
   private static final String PARAM_LANGUAGE = FIELD_LANGUAGE;
 
   private final Languages languages;
-
   private final QProfileLookup profileLookup;
-
   private final QProfileLoader profileLoader;
-
   private final QualityProfileDao qualityProfileDao;
 
   public SearchAction(Languages languages, QProfileLookup profileLookup, QProfileLoader profileLoader, QualityProfileDao qualityProfileDao) {
@@ -84,17 +81,12 @@ public class SearchAction implements QProfileWsAction {
       .setSince("5.2")
       .setDescription("List quality profiles.")
       .setHandler(this)
+      .addFieldsParam(ALL_FIELDS)
       .setResponseExample(getClass().getResource("example-search.json"));
 
     search.createParam(PARAM_LANGUAGE)
       .setDescription("The key of a language supported by the platform. If specified, only profiles for the given language are returned.")
-      .setExampleValue("js")
       .setPossibleValues(LanguageParamUtils.getLanguageKeys(languages));
-
-    search.createParam(Param.FIELDS)
-      .setDescription("Use to restrict returned fields.")
-      .setExampleValue("key,language")
-      .setPossibleValues(ALL_FIELDS);
   }
 
   @Override