]> source.dussan.org Git - sonarqube.git/commitdiff
Add some comments
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 7 Apr 2014 07:44:28 +0000 (09:44 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 7 Apr 2014 07:44:36 +0000 (09:44 +0200)
sonar-core/src/main/java/org/sonar/core/rule/RuleDao.java
sonar-core/src/test/java/org/sonar/core/rule/RuleDaoTest.java
sonar-server/src/main/java/org/sonar/server/debt/DebtModelOperations.java

index fe04585aa3ae5e480d512820f1e13a9add2420ae..3b5677fc9b90179452f1491a177be71f12e44f05 100644 (file)
@@ -80,8 +80,11 @@ public class RuleDao implements BatchComponent, ServerComponent {
     }
   }
 
-  public List<RuleDto> selectBySubCharacteristicId(Integer characteristicOrSubCharacteristicId, SqlSession session) {
-    return getMapper(session).selectBySubCharacteristicId(characteristicOrSubCharacteristicId);
+  /**
+   * Return all rules (even the REMOVED ones) linked on to a sub characteristic
+   */
+  public List<RuleDto> selectBySubCharacteristicId(Integer subCharacteristicId, SqlSession session) {
+    return getMapper(session).selectBySubCharacteristicId(subCharacteristicId);
   }
 
   @CheckForNull
index 0a51195d85cfa173f4a0d659208c8c14de4c05a4..6386962c054ab7ce98a067f8e6d3c0ceca4b45ad 100644 (file)
@@ -148,7 +148,7 @@ public class RuleDaoTest extends AbstractDaoTestCase {
   public void select_by_sub_characteristic_id(){
     setupData("select_by_sub_characteristic_id");
 
-    // Rules from sub characteristic
+    // Rules from sub characteristic (even REMOVED ones are returned)
     List<RuleDto> ruleDtos = dao.selectBySubCharacteristicId(3);
     assertThat(ruleDtos).hasSize(3);
     assertThat(idsFromRuleDtos(ruleDtos)).containsExactly(2, 4, 5);
index 78e21c36aeb14446410b0b0cec61092a8ad018aa..7c3934c8a47168705a657d19ec198fd16079b13f 100644 (file)
@@ -221,6 +221,7 @@ public class DebtModelOperations implements ServerComponent {
   }
 
   private void disableSubCharacteristic(CharacteristicDto subCharacteristic, Date updateDate, SqlSession session) {
+    // Disable debt on all rules (even REMOVED ones, in order to have no issue if they are reactivated) linked to the sub characteristic
     disableRulesDebt(ruleDao.selectBySubCharacteristicId(subCharacteristic.getId(), session), subCharacteristic.getId(), updateDate, session);
     disableCharacteristic(subCharacteristic, updateDate, session);
   }