From bac72033230c2ea0d1a99434376ae04ca05cf00e Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Tue, 8 Sep 2015 13:50:01 +0200 Subject: [PATCH] Small refactoring on qprofiles/search WS and ProjectRepositoryLoader --- .../sonar/server/batch/ProjectRepositoryLoader.java | 2 +- .../sonar/server/qualityprofile/ws/SearchAction.java | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectRepositoryLoader.java b/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectRepositoryLoader.java index e520ecf1e07..6d4ce4855e1 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectRepositoryLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectRepositoryLoader.java @@ -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 *

- * 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; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java index f9927daa8d1..e6dead6ed07 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/SearchAction.java @@ -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 -- 2.39.5