import org.sonar.server.rule.Rule;
import org.sonar.server.rule.index.RuleQuery;
+import javax.annotation.CheckForNull;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.Map;
Map<String, QualityProfileDto> qProfilesByKey = Maps.newHashMap();
for (String qProfileKey : harvestedProfileKeys) {
if (!qProfilesByKey.containsKey(qProfileKey)) {
- QualityProfileDto profile = loader.getByKey(qProfileKey);
+ QualityProfileDto profile = loadProfile(qProfileKey);
if (profile == null) {
LOG.warn("Could not find quality profile with key " + qProfileKey);
continue;
qProfilesByKey.put(qProfileKey, profile);
String parentKee = profile.getParentKee();
if (parentKee != null && !qProfilesByKey.containsKey(parentKee)) {
- qProfilesByKey.put(parentKee, loader.getByKey(parentKee));
+ qProfilesByKey.put(parentKee, loadProfile(parentKee));
}
}
}
json.endObject();
}
+ @CheckForNull
+ QualityProfileDto loadProfile(String qProfileKey) {
+ return loader.getByKey(qProfileKey);
+ }
+
private void writeProfile(JsonWriter json, QualityProfileDto profile) {
Language language = languages.get(profile.getLanguage());
String langName = language == null ? profile.getLanguage() : language.getName();
@Override
protected void writeFacets(Request request, QueryContext context, Result<?> results, JsonWriter json) {
+ addMandatoryFacetValues(results, RuleIndex.FACET_DEBT_CHARACTERISTICS, request.paramAsStrings(PARAM_SEVERITIES));
+ addMandatoryFacetValues(results, RuleIndex.FACET_LANGUAGES, request.paramAsStrings(PARAM_LANGUAGES));
+ addMandatoryFacetValues(results, RuleIndex.FACET_REPOSITORIES, request.paramAsStrings(PARAM_REPOSITORIES));
addMandatoryFacetValues(results, RuleIndex.FACET_STATUSES, RuleIndex.ALL_STATUSES_EXCEPT_REMOVED);
addMandatoryFacetValues(results, RuleIndex.FACET_SEVERITIES, Severity.ALL);
+ addMandatoryFacetValues(results, RuleIndex.FACET_TAGS, request.paramAsStrings(PARAM_TAGS));
super.writeFacets(request, context, results, json);
}
}