aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2014-05-13 23:50:33 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2014-05-13 23:50:33 +0200
commitc71a3ea9ac34da639fd896f07fba8b01b296b145 (patch)
treeb52455bc677cfd0e051fa17194527421bee6b79e
parent78f34d4e9c0030afb60ce848d087adee001aee09 (diff)
downloadsonarqube-c71a3ea9ac34da639fd896f07fba8b01b296b145.tar.gz
sonarqube-c71a3ea9ac34da639fd896f07fba8b01b296b145.zip
SONAR-5007 cleanup
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule/ws/AbstractUpdateTagsWsHandler.java4
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule/ws/AddTagsWsHandler.java4
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule/ws/RemoveTagsWsHandler.java4
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule/ws/RuleSearchWsHandler.java4
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule/ws/RuleShowWsHandler.java4
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule/ws/RuleTagsWs.java4
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule/ws/RulesWs.java4
-rw-r--r--sonar-server/src/main/java/org/sonar/server/rule2/RegisterRules.java10
8 files changed, 32 insertions, 6 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/ws/AbstractUpdateTagsWsHandler.java b/sonar-server/src/main/java/org/sonar/server/rule/ws/AbstractUpdateTagsWsHandler.java
index 50a2b56312b..7c64895f12e 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule/ws/AbstractUpdateTagsWsHandler.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule/ws/AbstractUpdateTagsWsHandler.java
@@ -32,6 +32,10 @@ import org.sonar.server.rule.Rules;
import java.util.Set;
+/**
+ * @deprecated to be dropped in 4.4
+ */
+@Deprecated
public abstract class AbstractUpdateTagsWsHandler implements RequestHandler {
private final Rules rules;
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/ws/AddTagsWsHandler.java b/sonar-server/src/main/java/org/sonar/server/rule/ws/AddTagsWsHandler.java
index f20552b213d..38d2d267441 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule/ws/AddTagsWsHandler.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule/ws/AddTagsWsHandler.java
@@ -24,6 +24,10 @@ import org.sonar.server.rule.Rules;
import java.util.Arrays;
import java.util.Set;
+/**
+ * @deprecated to be dropped in 4.4
+ */
+@Deprecated
public class AddTagsWsHandler extends AbstractUpdateTagsWsHandler {
public AddTagsWsHandler(Rules rules) {
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/ws/RemoveTagsWsHandler.java b/sonar-server/src/main/java/org/sonar/server/rule/ws/RemoveTagsWsHandler.java
index 552db68e9bd..9fe9c5ad77d 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule/ws/RemoveTagsWsHandler.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule/ws/RemoveTagsWsHandler.java
@@ -24,6 +24,10 @@ import org.sonar.server.rule.Rules;
import java.util.Arrays;
import java.util.Set;
+/**
+ * @deprecated to be dropped in 4.4
+ */
+@Deprecated
public class RemoveTagsWsHandler extends AbstractUpdateTagsWsHandler {
public RemoveTagsWsHandler(Rules rules) {
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleSearchWsHandler.java b/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleSearchWsHandler.java
index 672bb91c6a9..9aea4cb16b2 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleSearchWsHandler.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleSearchWsHandler.java
@@ -39,6 +39,10 @@ import javax.annotation.CheckForNull;
import java.util.Collection;
import java.util.Collections;
+/**
+ * @deprecated to be dropped in 4.4
+ */
+@Deprecated
public class RuleSearchWsHandler implements RequestHandler {
private final Rules rules;
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleShowWsHandler.java b/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleShowWsHandler.java
index 6a76e65d384..c250950f5aa 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleShowWsHandler.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleShowWsHandler.java
@@ -44,6 +44,10 @@ import javax.annotation.Nullable;
import java.util.Date;
+/**
+ * @deprecated to be dropped in 4.4
+ */
+@Deprecated
public class RuleShowWsHandler implements RequestHandler {
private final Rules rules;
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleTagsWs.java b/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleTagsWs.java
index 69801e05e43..2628ee3653e 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleTagsWs.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleTagsWs.java
@@ -27,6 +27,10 @@ import org.sonar.api.utils.text.JsonWriter;
import org.sonar.core.rule.RuleTagDto;
import org.sonar.server.rule.RuleTags;
+/**
+ * @deprecated to be dropped in 4.4
+ */
+@Deprecated
public class RuleTagsWs implements WebService {
private final RuleTags ruleTags;
diff --git a/sonar-server/src/main/java/org/sonar/server/rule/ws/RulesWs.java b/sonar-server/src/main/java/org/sonar/server/rule/ws/RulesWs.java
index 332cfc93d6f..75a4e13b64e 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule/ws/RulesWs.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule/ws/RulesWs.java
@@ -21,6 +21,10 @@ package org.sonar.server.rule.ws;
import org.sonar.api.server.ws.WebService;
+/**
+ * @deprecated to be dropped in 4.4
+ */
+@Deprecated
public class RulesWs implements WebService {
private final RuleSearchWsHandler searchHandler;
diff --git a/sonar-server/src/main/java/org/sonar/server/rule2/RegisterRules.java b/sonar-server/src/main/java/org/sonar/server/rule2/RegisterRules.java
index 577ec2b67db..afe1111ceac 100644
--- a/sonar-server/src/main/java/org/sonar/server/rule2/RegisterRules.java
+++ b/sonar-server/src/main/java/org/sonar/server/rule2/RegisterRules.java
@@ -21,6 +21,7 @@ package org.sonar.server.rule2;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
+import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
@@ -50,7 +51,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import static com.google.common.collect.Lists.newArrayList;
@@ -308,15 +308,14 @@ public class RegisterRules implements Startable {
private boolean mergeTags(RulesDefinition.Rule ruleDef, RuleDto dto) {
boolean changed = false;
- //the Rule is not active and dto has tags
if (Rule.STATUS_REMOVED.equals(ruleDef.status())) {
dto.setSystemTags(Collections.EMPTY_SET);
dto.setTags(Collections.EMPTY_SET);
changed = true;
} else if (!dto.getSystemTags().containsAll(ruleDef.tags())) {
- Set<String> tags = dto.getTags();
- tags.addAll(ruleDef.tags());
- dto.setSystemTags(tags);
+ dto.setSystemTags(ruleDef.tags());
+ // remove end-user tags that are now declared as system
+ RuleTagHelper.applyTags(dto, ImmutableSet.copyOf(dto.getTags()));
changed = true;
}
return changed;
@@ -382,7 +381,6 @@ public class RegisterRules implements Startable {
for (RuleDto rule : removedRules) {
// SONAR-4642 Remove active rules only when repository still exists
if (repositoryKeys.contains(rule.getRepositoryKey())) {
- // TODO
profilesManager.removeActivatedRules(rule.getId());
}
}