aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-deprecated/src/main
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-12-01 11:30:48 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-12-01 11:30:48 +0000
commite537ea6120df8eb20ba04da66811c21161f6ec6d (patch)
treee0e5898938290b5506bb834106c908780125ff88 /sonar-deprecated/src/main
parent0441e5cb03ef5fcd21f681682a994437e985768d (diff)
downloadsonarqube-e537ea6120df8eb20ba04da66811c21161f6ec6d.tar.gz
sonarqube-e537ea6120df8eb20ba04da66811c21161f6ec6d.zip
SONAR-2007 Remove the useless ISO Categories + fix components page
Diffstat (limited to 'sonar-deprecated/src/main')
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/checks/templates/CheckTemplateRepository.java41
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/checks/templates/XmlCheckTemplateFactory.java1
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/database/daos/RulesDao.java9
-rw-r--r--sonar-deprecated/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java4
4 files changed, 13 insertions, 42 deletions
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/CheckTemplateRepository.java b/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/CheckTemplateRepository.java
index fa96311c8db..3ebc5a99c0f 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/CheckTemplateRepository.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/CheckTemplateRepository.java
@@ -22,8 +22,10 @@ package org.sonar.api.checks.templates;
import org.apache.commons.io.IOUtils;
import org.sonar.api.profiles.RulesProfile;
import org.sonar.api.resources.Language;
-import org.sonar.api.rules.*;
-import org.sonar.check.IsoCategory;
+import org.sonar.api.rules.Rule;
+import org.sonar.api.rules.RuleParam;
+import org.sonar.api.rules.RulePriority;
+import org.sonar.api.rules.RulesRepository;
import java.io.InputStream;
import java.util.*;
@@ -134,20 +136,12 @@ public class CheckTemplateRepository implements RulesRepository {
}
-
-
-
-
-
-
-
-
/*
- CODE FOR BACKWARD COMPATIBLITY
- This class should not extend RulesRepository in next versions
+ CODE FOR BACKWARD COMPATIBLITY
+ This class should not extend RulesRepository in next versions
- */
+ */
public List<Rule> getInitialReferential() {
@@ -163,7 +157,6 @@ public class CheckTemplateRepository implements RulesRepository {
rule.setDescription(checkTemplate.getDescription(Locale.ENGLISH));
rule.setName(checkTemplate.getTitle(Locale.ENGLISH));
rule.setPriority(RulePriority.fromCheckPriority(checkTemplate.getPriority()));
- rule.setRulesCategory(toRuleCategory(checkTemplate.getIsoCategory()));
for (CheckTemplateProperty checkTemplateProperty : checkTemplate.getProperties()) {
RuleParam param = rule.createParameter(checkTemplateProperty.getKey());
param.setDescription(checkTemplateProperty.getDescription(Locale.ENGLISH));
@@ -173,26 +166,6 @@ public class CheckTemplateRepository implements RulesRepository {
return rule;
}
- private RulesCategory toRuleCategory(IsoCategory isoCategory) {
- if (isoCategory == IsoCategory.Reliability) {
- return Iso9126RulesCategories.RELIABILITY;
- }
- if (isoCategory == IsoCategory.Efficiency) {
- return Iso9126RulesCategories.EFFICIENCY;
- }
- if (isoCategory == IsoCategory.Maintainability) {
- return Iso9126RulesCategories.MAINTAINABILITY;
- }
- if (isoCategory == IsoCategory.Portability) {
- return Iso9126RulesCategories.PORTABILITY;
- }
- if (isoCategory == IsoCategory.Usability) {
- return Iso9126RulesCategories.USABILITY;
- }
- return null;
- }
-
-
public List<Rule> parseReferential(String fileContent) {
return Collections.emptyList();
}
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/XmlCheckTemplateFactory.java b/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/XmlCheckTemplateFactory.java
index 0b51222c53d..1de8a616a0c 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/XmlCheckTemplateFactory.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/checks/templates/XmlCheckTemplateFactory.java
@@ -75,7 +75,6 @@ public class XmlCheckTemplateFactory {
template.setConfigKey(rule.getConfigKey());
template.setDescription(rule.getDescription());
- template.setIsoCategory(rule.getRulesCategory().toIsoCategory());
template.setPriority(rule.getPriority().toCheckPriority());
template.setTitle(rule.getName());
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/database/daos/RulesDao.java b/sonar-deprecated/src/main/java/org/sonar/api/database/daos/RulesDao.java
index 1d5d5fb90bc..cb7842f049d 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/database/daos/RulesDao.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/database/daos/RulesDao.java
@@ -27,6 +27,7 @@ import org.sonar.api.rules.Rule;
import org.sonar.api.rules.RuleParam;
import org.sonar.api.rules.RulesCategory;
+import java.util.Collections;
import java.util.List;
@Deprecated
@@ -47,7 +48,7 @@ public class RulesDao {
}
public List<Rule> getRulesByCategory(RulesCategory categ) {
- return target.getRulesByCategory(categ);
+ return Collections.emptyList();
}
public Rule getRuleByKey(String pluginKey, String ruleKey) {
@@ -55,15 +56,15 @@ public class RulesDao {
}
public Long countRules(List<String> plugins, String categoryName) {
- return target.countRules(plugins, categoryName);
+ return target.countRules(plugins);
}
public List<RulesCategory> getCategories() {
- return target.getCategories();
+ return Collections.emptyList();
}
public RulesCategory getCategory(String key) {
- return target.getCategory(key);
+ return null;
}
diff --git a/sonar-deprecated/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java b/sonar-deprecated/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java
index e532df1d040..58b8c69abbc 100644
--- a/sonar-deprecated/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java
+++ b/sonar-deprecated/src/main/java/org/sonar/api/rules/StandardRulesXmlParser.java
@@ -105,9 +105,7 @@ public class StandardRulesXmlParser {
xstream.registerConverter(new TrimStringConverter());
xstream.alias("rules", ArrayList.class);
- xstream.alias("categ", RulesCategory.class);
- xstream.useAttributeFor(RulesCategory.class, "name");
- xstream.aliasField("category", Rule.class, "rulesCategory");
+ xstream.omitField(Rule.class, "category");
xstream.alias("rule", Rule.class);
xstream.useAttributeFor(Rule.class, "key");