aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-06-03 21:41:22 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-06-03 22:23:42 +0200
commit65920936508883a128dab1b77f9a49332bb5d363 (patch)
treec5c1c4bca932fd0d0d076b08c365f41fb29fc531 /sonar-server/src/main
parente819f581d68c38bb72cae13c41196024d87d9397 (diff)
downloadsonarqube-65920936508883a128dab1b77f9a49332bb5d363.tar.gz
sonarqube-65920936508883a128dab1b77f9a49332bb5d363.zip
SONAR-5007 delete QualityProfileService
Diffstat (limited to 'sonar-server/src/main')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java148
-rw-r--r--sonar-server/src/main/java/org/sonar/server/qualityprofile/ActiveRuleDocument.java42
-rw-r--r--sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileService.java24
-rw-r--r--sonar-server/src/main/java/org/sonar/server/qualityprofile/QualityProfileService.java42
-rw-r--r--sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java9
-rw-r--r--sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java27
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java14
7 files changed, 178 insertions, 128 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java b/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
index 6d043558e64..bc15fb2498b 100644
--- a/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
+++ b/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
@@ -52,7 +52,13 @@ import org.sonar.core.measure.db.MeasureFilterDao;
import org.sonar.core.metric.DefaultMetricFinder;
import org.sonar.core.notification.DefaultNotificationManager;
import org.sonar.core.permission.PermissionFacade;
-import org.sonar.core.persistence.*;
+import org.sonar.core.persistence.DaoUtils;
+import org.sonar.core.persistence.DatabaseVersion;
+import org.sonar.core.persistence.DefaultDatabase;
+import org.sonar.core.persistence.MyBatis;
+import org.sonar.core.persistence.PreviewDatabaseFactory;
+import org.sonar.core.persistence.SemaphoreUpdater;
+import org.sonar.core.persistence.SemaphoresImpl;
import org.sonar.core.preview.PreviewCache;
import org.sonar.core.profiling.Profiling;
import org.sonar.core.purge.PurgeProfiler;
@@ -86,11 +92,33 @@ import org.sonar.server.db.DbClient;
import org.sonar.server.db.EmbeddedDatabaseFactory;
import org.sonar.server.db.migrations.DatabaseMigrations;
import org.sonar.server.db.migrations.DatabaseMigrator;
-import org.sonar.server.debt.*;
+import org.sonar.server.debt.DebtCharacteristicsXMLImporter;
+import org.sonar.server.debt.DebtModelBackup;
+import org.sonar.server.debt.DebtModelLookup;
+import org.sonar.server.debt.DebtModelOperations;
+import org.sonar.server.debt.DebtModelPluginRepository;
+import org.sonar.server.debt.DebtModelService;
+import org.sonar.server.debt.DebtModelXMLExporter;
+import org.sonar.server.debt.DebtRulesXMLImporter;
import org.sonar.server.duplication.ws.DuplicationsParser;
import org.sonar.server.duplication.ws.DuplicationsWriter;
import org.sonar.server.duplication.ws.DuplicationsWs;
-import org.sonar.server.issue.*;
+import org.sonar.server.issue.ActionService;
+import org.sonar.server.issue.AssignAction;
+import org.sonar.server.issue.CommentAction;
+import org.sonar.server.issue.DefaultIssueFinder;
+import org.sonar.server.issue.InternalRubyIssueService;
+import org.sonar.server.issue.IssueBulkChangeService;
+import org.sonar.server.issue.IssueChangelogFormatter;
+import org.sonar.server.issue.IssueChangelogService;
+import org.sonar.server.issue.IssueCommentService;
+import org.sonar.server.issue.IssueService;
+import org.sonar.server.issue.IssueStatsFinder;
+import org.sonar.server.issue.PlanAction;
+import org.sonar.server.issue.PublicRubyIssueService;
+import org.sonar.server.issue.ServerIssueStorage;
+import org.sonar.server.issue.SetSeverityAction;
+import org.sonar.server.issue.TransitionAction;
import org.sonar.server.issue.actionplan.ActionPlanService;
import org.sonar.server.issue.actionplan.ActionPlanWs;
import org.sonar.server.issue.filter.IssueFilterService;
@@ -115,22 +143,81 @@ import org.sonar.server.platform.ws.L10nWs;
import org.sonar.server.platform.ws.RestartHandler;
import org.sonar.server.platform.ws.ServerWs;
import org.sonar.server.platform.ws.SystemWs;
-import org.sonar.server.plugins.*;
+import org.sonar.server.plugins.BatchWs;
+import org.sonar.server.plugins.InstalledPluginReferentialFactory;
+import org.sonar.server.plugins.PluginDownloader;
+import org.sonar.server.plugins.ServerExtensionInstaller;
+import org.sonar.server.plugins.ServerPluginJarInstaller;
+import org.sonar.server.plugins.ServerPluginJarsInstaller;
+import org.sonar.server.plugins.ServerPluginRepository;
+import org.sonar.server.plugins.UpdateCenterClient;
+import org.sonar.server.plugins.UpdateCenterMatrixFactory;
import org.sonar.server.qualitygate.QgateProjectFinder;
import org.sonar.server.qualitygate.QualityGates;
import org.sonar.server.qualitygate.RegisterQualityGates;
-import org.sonar.server.qualitygate.ws.*;
-import org.sonar.server.qualityprofile.*;
+import org.sonar.server.qualitygate.ws.QGatesAppAction;
+import org.sonar.server.qualitygate.ws.QGatesCopyAction;
+import org.sonar.server.qualitygate.ws.QGatesCreateAction;
+import org.sonar.server.qualitygate.ws.QGatesCreateConditionAction;
+import org.sonar.server.qualitygate.ws.QGatesDeleteConditionAction;
+import org.sonar.server.qualitygate.ws.QGatesDeselectAction;
+import org.sonar.server.qualitygate.ws.QGatesDestroyAction;
+import org.sonar.server.qualitygate.ws.QGatesListAction;
+import org.sonar.server.qualitygate.ws.QGatesRenameAction;
+import org.sonar.server.qualitygate.ws.QGatesSearchAction;
+import org.sonar.server.qualitygate.ws.QGatesSelectAction;
+import org.sonar.server.qualitygate.ws.QGatesSetAsDefaultAction;
+import org.sonar.server.qualitygate.ws.QGatesShowAction;
+import org.sonar.server.qualitygate.ws.QGatesUnsetDefaultAction;
+import org.sonar.server.qualitygate.ws.QGatesUpdateConditionAction;
+import org.sonar.server.qualitygate.ws.QGatesWs;
+import org.sonar.server.qualityprofile.DefaultProfilesCache;
+import org.sonar.server.qualityprofile.ProfilesManager;
+import org.sonar.server.qualityprofile.QProfileActiveRuleOperations;
+import org.sonar.server.qualityprofile.QProfileBackup;
+import org.sonar.server.qualityprofile.QProfileBackuper;
+import org.sonar.server.qualityprofile.QProfileCopier;
+import org.sonar.server.qualityprofile.QProfileLookup;
+import org.sonar.server.qualityprofile.QProfileOperations;
+import org.sonar.server.qualityprofile.QProfileProjectLookup;
+import org.sonar.server.qualityprofile.QProfileProjectOperations;
+import org.sonar.server.qualityprofile.QProfileRepositoryExporter;
+import org.sonar.server.qualityprofile.QProfileService;
+import org.sonar.server.qualityprofile.QProfiles;
+import org.sonar.server.qualityprofile.RegisterQualityProfiles;
+import org.sonar.server.qualityprofile.RuleActivationContextFactory;
+import org.sonar.server.qualityprofile.RuleActivator;
import org.sonar.server.qualityprofile.db.ActiveRuleDao;
import org.sonar.server.qualityprofile.index.ActiveRuleIndex;
import org.sonar.server.qualityprofile.index.ActiveRuleNormalizer;
-import org.sonar.server.qualityprofile.ws.*;
-import org.sonar.server.rule.*;
+import org.sonar.server.qualityprofile.ws.BulkRuleActivationActions;
+import org.sonar.server.qualityprofile.ws.ProfilesWs;
+import org.sonar.server.qualityprofile.ws.QProfileRecreateBuiltInAction;
+import org.sonar.server.qualityprofile.ws.QProfilesWs;
+import org.sonar.server.qualityprofile.ws.RuleActivationActions;
+import org.sonar.server.rule.DeprecatedRulesDefinition;
+import org.sonar.server.rule.RegisterRules;
+import org.sonar.server.rule.RubyRuleService;
+import org.sonar.server.rule.RuleDefinitionsLoader;
+import org.sonar.server.rule.RuleOperations;
+import org.sonar.server.rule.RuleRepositories;
+import org.sonar.server.rule.RuleService;
+import org.sonar.server.rule.RuleUpdater;
import org.sonar.server.rule.db.RuleDao;
import org.sonar.server.rule.index.RuleIndex;
import org.sonar.server.rule.index.RuleNormalizer;
-import org.sonar.server.rule.ws.*;
-import org.sonar.server.search.*;
+import org.sonar.server.rule.ws.ActiveRuleCompleter;
+import org.sonar.server.rule.ws.AppAction;
+import org.sonar.server.rule.ws.RuleMapping;
+import org.sonar.server.rule.ws.RulesWebService;
+import org.sonar.server.rule.ws.SearchAction;
+import org.sonar.server.rule.ws.TagsAction;
+import org.sonar.server.rule.ws.UpdateAction;
+import org.sonar.server.search.ESNode;
+import org.sonar.server.search.IndexClient;
+import org.sonar.server.search.IndexQueue;
+import org.sonar.server.search.IndexQueueWorker;
+import org.sonar.server.search.IndexSynchronizer;
import org.sonar.server.source.CodeColorizers;
import org.sonar.server.source.DeprecatedSourceDecorator;
import org.sonar.server.source.HtmlSourceDecorator;
@@ -139,9 +226,27 @@ import org.sonar.server.source.ws.ScmAction;
import org.sonar.server.source.ws.ScmWriter;
import org.sonar.server.source.ws.ShowAction;
import org.sonar.server.source.ws.SourcesWs;
-import org.sonar.server.startup.*;
+import org.sonar.server.startup.CleanPreviewAnalysisCache;
+import org.sonar.server.startup.CopyRequirementsFromCharacteristicsToRules;
+import org.sonar.server.startup.GeneratePluginIndex;
+import org.sonar.server.startup.GwtPublisher;
+import org.sonar.server.startup.JdbcDriverDeployer;
+import org.sonar.server.startup.LogServerId;
+import org.sonar.server.startup.RegisterDashboards;
+import org.sonar.server.startup.RegisterDebtModel;
+import org.sonar.server.startup.RegisterMetrics;
+import org.sonar.server.startup.RegisterNewMeasureFilters;
+import org.sonar.server.startup.RegisterPermissionTemplates;
+import org.sonar.server.startup.RegisterServletFilters;
+import org.sonar.server.startup.RenameDeprecatedPropertyKeys;
+import org.sonar.server.startup.ServerMetadataPersister;
import org.sonar.server.test.CoverageService;
-import org.sonar.server.test.ws.*;
+import org.sonar.server.test.ws.CoverageShowAction;
+import org.sonar.server.test.ws.CoverageWs;
+import org.sonar.server.test.ws.TestsPlanAction;
+import org.sonar.server.test.ws.TestsShowAction;
+import org.sonar.server.test.ws.TestsTestableAction;
+import org.sonar.server.test.ws.TestsWs;
import org.sonar.server.text.MacroInterpreter;
import org.sonar.server.text.RubyTextService;
import org.sonar.server.ui.JRubyI18n;
@@ -149,9 +254,20 @@ import org.sonar.server.ui.JRubyProfiling;
import org.sonar.server.ui.PageDecorations;
import org.sonar.server.ui.Views;
import org.sonar.server.updatecenter.ws.UpdateCenterWs;
-import org.sonar.server.user.*;
+import org.sonar.server.user.DefaultUserService;
+import org.sonar.server.user.DoPrivileged;
+import org.sonar.server.user.GroupMembershipFinder;
+import org.sonar.server.user.GroupMembershipService;
+import org.sonar.server.user.NewUserNotifier;
+import org.sonar.server.user.SecurityRealmFactory;
import org.sonar.server.user.ws.UsersWs;
-import org.sonar.server.util.*;
+import org.sonar.server.util.BooleanTypeValidation;
+import org.sonar.server.util.FloatTypeValidation;
+import org.sonar.server.util.IntegerTypeValidation;
+import org.sonar.server.util.StringListTypeValidation;
+import org.sonar.server.util.StringTypeValidation;
+import org.sonar.server.util.TextTypeValidation;
+import org.sonar.server.util.TypeValidations;
import org.sonar.server.ws.ListingWs;
import org.sonar.server.ws.WebServiceEngine;
@@ -292,8 +408,6 @@ class ServerComponents {
pico.addComponent(ProfilesDao.class, false);
pico.addComponent(ProfilesManager.class, false);
pico.addSingleton(AnnotationProfileParser.class);
-
- pico.addSingleton(QualityProfileService.class);
pico.addSingleton(QProfiles.class);
pico.addSingleton(QProfileLookup.class);
pico.addSingleton(QProfileOperations.class);
@@ -311,6 +425,8 @@ class ServerComponents {
pico.addSingleton(RuleActivator.class);
pico.addSingleton(QProfileService.class);
pico.addSingleton(RuleActivationContextFactory.class);
+ pico.addSingleton(QProfileCopier.class);
+ pico.addSingleton(QProfileBackuper.class);
// rule
pico.addSingleton(AnnotationRuleParser.class);
diff --git a/sonar-server/src/main/java/org/sonar/server/qualityprofile/ActiveRuleDocument.java b/sonar-server/src/main/java/org/sonar/server/qualityprofile/ActiveRuleDocument.java
deleted file mode 100644
index a659c755b71..00000000000
--- a/sonar-server/src/main/java/org/sonar/server/qualityprofile/ActiveRuleDocument.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.server.qualityprofile;
-
-/**
- * @deprecated to be dropped in 4.4
- */
-@Deprecated
-public class ActiveRuleDocument {
-
- public static final String FIELD_ID = "id";
- public static final String FIELD_SEVERITY = "severity";
- public static final String FIELD_PROFILE_ID = "profileId";
- public static final String FIELD_INHERITANCE = "inheritance";
- public static final String FIELD_ACTIVE_RULE_PARENT_ID = "activeRuleParentId";
- public static final String FIELD_PARAMS = "params";
-
- public static final String FIELD_PARAM_KEY = "key";
- public static final String FIELD_PARAM_VALUE = "value";
-
- private ActiveRuleDocument() {
- // Only constants
- }
-
-}
diff --git a/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileService.java b/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileService.java
index 6ab6a910b8d..16f0f5dc92c 100644
--- a/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileService.java
+++ b/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileService.java
@@ -23,8 +23,11 @@ import com.google.common.collect.Multimap;
import org.sonar.api.ServerComponent;
import org.sonar.api.rule.RuleKey;
import org.sonar.core.permission.GlobalPermissions;
+import org.sonar.core.persistence.DbSession;
import org.sonar.core.qualityprofile.db.ActiveRuleKey;
+import org.sonar.core.qualityprofile.db.QualityProfileDto;
import org.sonar.core.qualityprofile.db.QualityProfileKey;
+import org.sonar.server.db.DbClient;
import org.sonar.server.qualityprofile.index.ActiveRuleIndex;
import org.sonar.server.rule.index.RuleQuery;
import org.sonar.server.search.IndexClient;
@@ -40,19 +43,34 @@ import java.util.List;
public class QProfileService implements ServerComponent {
+ private final DbClient db;
private final IndexClient index;
private final RuleActivator ruleActivator;
private final QProfileBackuper backuper;
private final QProfileCopier copier;
- public QProfileService(IndexClient index, RuleActivator ruleActivator, QProfileBackuper backuper,
+ public QProfileService(DbClient db, IndexClient index, RuleActivator ruleActivator, QProfileBackuper backuper,
QProfileCopier copier) {
+ this.db = db;
this.index = index;
this.ruleActivator = ruleActivator;
this.backuper = backuper;
this.copier = copier;
}
+ /**
+ * Returns all Quality profiles as DTOs. This is a temporary solution as long as
+ * profiles are not indexed and declared as a business object
+ */
+ public List<QualityProfileDto> findAll() {
+ DbSession dbSession = db.openSession(false);
+ try {
+ return db.qualityProfileDao().findAll(dbSession);
+ } finally {
+ dbSession.close();
+ }
+ }
+
@CheckForNull
public ActiveRule getActiveRule(ActiveRuleKey key) {
return index.get(ActiveRuleIndex.class).getByKey(key);
@@ -85,9 +103,9 @@ public class QProfileService implements ServerComponent {
}
- public Multimap<String, String> bulkActivate(RuleQuery ruleQuery, QualityProfileKey profile) {
+ public Multimap<String, String> bulkActivate(RuleQuery ruleQuery, QualityProfileKey profile, @Nullable String severity) {
verifyAdminPermission();
- return ruleActivator.bulkActivate(ruleQuery, profile);
+ return ruleActivator.bulkActivate(ruleQuery, profile, severity);
}
public Multimap<String, String> bulkDeactivate(RuleQuery ruleQuery, QualityProfileKey profile) {
diff --git a/sonar-server/src/main/java/org/sonar/server/qualityprofile/QualityProfileService.java b/sonar-server/src/main/java/org/sonar/server/qualityprofile/QualityProfileService.java
deleted file mode 100644
index f31f144a26a..00000000000
--- a/sonar-server/src/main/java/org/sonar/server/qualityprofile/QualityProfileService.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.server.qualityprofile;
-
-import org.sonar.api.ServerComponent;
-import org.sonar.core.qualityprofile.db.QualityProfileDto;
-import org.sonar.server.db.DbClient;
-
-import java.util.List;
-
-/**
- * @since 4.4
- */
-public class QualityProfileService implements ServerComponent {
-
- private final DbClient dbClient;
-
- public QualityProfileService(DbClient dbClient) {
- this.dbClient = dbClient;
- }
-
- public List<QualityProfileDto> findAll() {
- return dbClient.qualityProfileDao().selectAll();
- }
-}
diff --git a/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java b/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java
index c53ea36ea98..dcab4ba292f 100644
--- a/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java
+++ b/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivator.java
@@ -39,6 +39,7 @@ import org.sonar.server.db.DbClient;
import org.sonar.server.qualityprofile.db.ActiveRuleDao;
import org.sonar.server.rule.Rule;
import org.sonar.server.rule.index.RuleIndex;
+import org.sonar.server.rule.index.RuleNormalizer;
import org.sonar.server.rule.index.RuleQuery;
import org.sonar.server.rule.index.RuleResult;
import org.sonar.server.search.IndexClient;
@@ -275,7 +276,7 @@ public class RuleActivator implements ServerComponent {
}
}
- Multimap<String, String> bulkActivate(RuleQuery ruleQuery, QualityProfileKey profile) {
+ public Multimap<String, String> bulkActivate(RuleQuery ruleQuery, QualityProfileKey profileKey, @Nullable String severity) {
RuleIndex ruleIndex = index.get(RuleIndex.class);
Multimap<String, String> results = ArrayListMultimap.create();
DbSession dbSession = db.openSession(false);
@@ -290,9 +291,9 @@ public class RuleActivator implements ServerComponent {
for (Rule rule : result.getHits()) {
if (!rule.isTemplate()) {
- ActiveRuleKey key = ActiveRuleKey.of(profile, rule.key());
+ ActiveRuleKey key = ActiveRuleKey.of(profileKey, rule.key());
RuleActivation activation = new RuleActivation(key);
- if(severity != null && !severity.isEmpty()){
+ if (severity != null && !severity.isEmpty()) {
activation.setSeverity(severity);
} else {
activation.setSeverity(rule.severity());
@@ -311,7 +312,7 @@ public class RuleActivator implements ServerComponent {
return results;
}
- Multimap<String, String> bulkDeactivate(RuleQuery ruleQuery, QualityProfileKey profile) {
+ public Multimap<String, String> bulkDeactivate(RuleQuery ruleQuery, QualityProfileKey profile) {
RuleIndex ruleIndex = index.get(RuleIndex.class);
Multimap<String, String> results = ArrayListMultimap.create();
DbSession dbSession = db.openSession(false);
diff --git a/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java b/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java
index c90473c652f..b0dfd44c673 100644
--- a/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java
+++ b/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/BulkRuleActivationActions.java
@@ -35,16 +35,16 @@ import org.sonar.server.rule.ws.SearchAction;
public class BulkRuleActivationActions implements ServerComponent {
public static final String PROFILE_KEY = "profile_key";
- public static final String SEVERITY = "activation_severity";
+ public static final String SEVERITY = "severity";
public static final String BULK_ACTIVATE_ACTION = "activate_rules";
public static final String BULK_DEACTIVATE_ACTION = "deactivate_rules";
- private final RuleActivator activation;
+ private final QProfileService profileService;
private final RuleService ruleService;
- public BulkRuleActivationActions(QProfileService service, RuleActivator activation, RuleService ruleService) {
- this.activation = activation;
+ public BulkRuleActivationActions(QProfileService profileService, RuleService ruleService) {
+ this.profileService = profileService;
this.ruleService = ruleService;
}
@@ -67,10 +67,10 @@ public class BulkRuleActivationActions implements ServerComponent {
});
SearchAction.defineRuleSearchParameters(activate);
- defineProfileKeyParameters(activate);
+ defineProfileKeyParameter(activate);
activate.createParam(SEVERITY)
- .setDescription("Set severity of rules activated in bulk")
+ .setDescription("Optional severity of rules activated in bulk")
.setPossibleValues(Severity.ALL);
}
@@ -88,18 +88,18 @@ public class BulkRuleActivationActions implements ServerComponent {
});
SearchAction.defineRuleSearchParameters(deactivate);
- defineProfileKeyParameters(deactivate);
+ defineProfileKeyParameter(deactivate);
}
- private void defineProfileKeyParameters(WebService.NewAction action) {
+ private void defineProfileKeyParameter(WebService.NewAction action) {
action.createParam(PROFILE_KEY)
- .setDescription("Quality Profile Key. To retrieve a profileKey for a given language please see the /api/qprofile documentation")
+ .setDescription("Quality Profile Key. To retrieve a profile key for a given language please see the api/qprofiles documentation")
.setRequired(true)
- .setExampleValue("java:My Profile");
+ .setExampleValue("java:MyProfile");
}
private void bulkActivate(Request request, Response response) throws Exception {
- Multimap<String, String> results = activation.bulkActivate(
+ Multimap<String, String> results = profileService.bulkActivate(
SearchAction.createRuleQuery(ruleService.newRuleQuery(), request),
readKey(request),
request.param(SEVERITY));
@@ -107,7 +107,7 @@ public class BulkRuleActivationActions implements ServerComponent {
}
private void bulkDeactivate(Request request, Response response) throws Exception {
- Multimap<String, String> results = activation.bulkDeactivate(
+ Multimap<String, String> results = profileService.bulkDeactivate(
SearchAction.createRuleQuery(ruleService.newRuleQuery(), request),
readKey(request));
writeResponse(results, response);
@@ -118,7 +118,8 @@ public class BulkRuleActivationActions implements ServerComponent {
for (String action : results.keySet()) {
json.name(action).beginArray();
for (String key : results.get(action)) {
- json.beginObject()
+ json
+ .beginObject()
.prop("key", key)
.endObject();
}
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java b/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java
index 5cb546696aa..329ffc0d6fc 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule/ws/AppAction.java
@@ -34,7 +34,7 @@ import org.sonar.api.server.ws.WebService;
import org.sonar.api.utils.text.JsonWriter;
import org.sonar.core.permission.GlobalPermissions;
import org.sonar.core.qualityprofile.db.QualityProfileDto;
-import org.sonar.server.qualityprofile.QualityProfileService;
+import org.sonar.server.qualityprofile.QProfileService;
import org.sonar.server.rule.RuleRepositories;
import org.sonar.server.rule.RuleRepositories.Repository;
import org.sonar.server.user.UserSession;
@@ -51,9 +51,10 @@ public class AppAction implements RequestHandler {
private final RuleRepositories ruleRepositories;
private final I18n i18n;
private final DebtModel debtModel;
- private final QualityProfileService qualityProfileService;
+ private final QProfileService qualityProfileService;
- public AppAction(Languages languages, RuleRepositories ruleRepositories, I18n i18n, DebtModel debtModel, QualityProfileService qualityProfileService) {
+ public AppAction(Languages languages, RuleRepositories ruleRepositories, I18n i18n,
+ DebtModel debtModel, QProfileService qualityProfileService) {
this.languages = languages;
this.ruleRepositories = ruleRepositories;
this.i18n = i18n;
@@ -88,12 +89,9 @@ public class AppAction implements RequestHandler {
.prop("lang", profile.getLanguage())
.prop("parent", profile.getParent());
if (profile.getParentKey() != null) {
- json
- .prop("parentKey", profile.getParentKey().toString());
-
+ json.prop("parentKey", profile.getParentKey().toString());
}
- json
- .endObject();
+ json.endObject();
}
}
json.endArray();