From: Simon Brandhof Date: Wed, 30 Apr 2014 09:09:00 +0000 (+0200) Subject: Minor changes on org.sonar.server.rule2 X-Git-Tag: 4.4-RC1~1322 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b40a2f89f5949dcd840c457c45d7da7b3118dd83;p=sonarqube.git Minor changes on org.sonar.server.rule2 --- diff --git a/sonar-server/src/main/java/org/sonar/server/rule2/RuleDoc.java b/sonar-server/src/main/java/org/sonar/server/rule2/RuleDoc.java index 791609101ea..c06b3eee4e1 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule2/RuleDoc.java +++ b/sonar-server/src/main/java/org/sonar/server/rule2/RuleDoc.java @@ -17,25 +17,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* -* 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.rule2; import org.sonar.api.rule.RuleKey; diff --git a/sonar-server/src/main/java/org/sonar/server/rule2/RuleImpl.java b/sonar-server/src/main/java/org/sonar/server/rule2/RuleImpl.java deleted file mode 100644 index 5aa76480e8a..00000000000 --- a/sonar-server/src/main/java/org/sonar/server/rule2/RuleImpl.java +++ /dev/null @@ -1,129 +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.rule2; - -import org.sonar.api.rule.RuleKey; -import org.sonar.api.rule.RuleStatus; -import org.sonar.api.server.debt.DebtRemediationFunction; -import org.sonar.server.search.Hit; - -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class RuleImpl implements Rule { - - private Map fields; - - public RuleImpl(){ - this.fields = new HashMap(); - } - - private RuleImpl(Map fields){ - this.fields = fields; - } - - @Override - public RuleKey key() { - return RuleKey.of((String)this.fields.get("repositoryKey"), - (String)this.fields.get("ruleKey")); - } - - @Override - public String language() { - return (String) this.fields.get("language"); - } - - @Override - public String name() { - return (String) this.fields.get("name"); - } - - @Override - public String description() { - return (String) this.fields.get("description"); - } - - @Override - public String severity() { - return (String) this.fields.get("severity"); - } - - @Override - public RuleStatus status() { - return RuleStatus.valueOf( (String) this.fields.get("status")); - } - - @Override - public boolean template() { - //FIXME missign information in map. - return false; - } - - @Override - @SuppressWarnings("unchecked") - public List tags() { - return (List) this.fields.get("tags"); - } - - @Override - @SuppressWarnings("unchecked") - public List systemTags() { - return (List) this.fields.get("systemTags"); - } - - @Override - public List params() { - //FIXME not yet Implemented in ES - return Collections.emptyList(); - } - - @Override - public String debtCharacteristicKey() { - return (String) this.fields.get("debtCharacteristicKey"); - } - - @Override - public String debtSubCharacteristicKey() { - return (String) this.fields.get("debtSubCharacteristicKey"); - } - - @Override - public DebtRemediationFunction debtRemediationFunction() { - //FIXME how to construct from string "defaultRemediationFunction" - return null; - } - - @Override - public Date createdAt() { - return (Date) this.fields.get("createdAt"); - } - - @Override - public Date updatedAt() { - return (Date) this.fields.get("updatedAt"); - } - - public static Rule fromHit(Hit hit) { - return new RuleImpl(hit.getFields()); - } -} diff --git a/sonar-server/src/main/java/org/sonar/server/rule2/RuleIndex.java b/sonar-server/src/main/java/org/sonar/server/rule2/RuleIndex.java index be2b188bcb5..2259c7a8979 100644 --- a/sonar-server/src/main/java/org/sonar/server/rule2/RuleIndex.java +++ b/sonar-server/src/main/java/org/sonar/server/rule2/RuleIndex.java @@ -29,7 +29,6 @@ import org.sonar.core.profiling.Profiling; import org.sonar.core.qualityprofile.db.ActiveRuleDao; import org.sonar.core.qualityprofile.db.ActiveRuleDto; import org.sonar.core.rule.RuleConstants; -import org.sonar.server.rule2.RuleDao; import org.sonar.core.rule.RuleDto; import org.sonar.server.es.ESNode; import org.sonar.server.search.BaseIndex;