aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2015-06-12 15:47:34 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2015-06-12 15:47:34 +0200
commitba81359381fc1f77efdcd919ea5cfb5e71ff0f43 (patch)
treeac08f64ce1047007d395680471031885783262d9
parentebf6040b060322040a35ab17cfddeed6e3c713c1 (diff)
downloadsonarqube-ba81359381fc1f77efdcd919ea5cfb5e71ff0f43.tar.gz
sonarqube-ba81359381fc1f77efdcd919ea5cfb5e71ff0f43.zip
Minor update on DebtModel
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/debt/MutableDebtModelHolder.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/computation/step/FeedDebtModelStep.java10
2 files changed, 6 insertions, 6 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/debt/MutableDebtModelHolder.java b/server/sonar-server/src/main/java/org/sonar/server/computation/debt/MutableDebtModelHolder.java
index 6e6c09fb448..665986425bf 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/debt/MutableDebtModelHolder.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/debt/MutableDebtModelHolder.java
@@ -23,7 +23,7 @@ package org.sonar.server.computation.debt;
public interface MutableDebtModelHolder extends DebtModelHolder {
/**
- * Sets the characteristics in the {@link DebtModelHolder}. Settings characteristics more than once is not allowed
+ * Sets the characteristics in the {@link DebtModelHolder}.
*
* @param rootCharacteristic a root {@link Characteristic}, can not be {@code null}
* @param subCharacteristics list of sub characteristics of the root characteristic, can not be {@code null}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/FeedDebtModelStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/FeedDebtModelStep.java
index fe454c5b15a..ca491bc53c7 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/FeedDebtModelStep.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/FeedDebtModelStep.java
@@ -66,11 +66,11 @@ public class FeedDebtModelStep implements ComputationStep {
for (Map.Entry<Integer, Collection<CharacteristicDto>> entry : FluentIterable.from(characteristicDtos)
.filter(Predicates.not(IsRootPredicate.INSTANCE))
- .index(DtoToParentIdFunction.INSTANCE)
+ .index(CharacteristicDtoToParentId.INSTANCE)
.asMap().entrySet()) {
mutableDebtModelHolder.addCharacteristics(
toCharacteristic(rootCharacteristicsById.get(entry.getKey())),
- FluentIterable.from(entry.getValue()).transform(DtoToCharFunction.INSTANCE)
+ FluentIterable.from(entry.getValue()).transform(CharacteristicDtoToCharacteristic.INSTANCE)
);
}
}
@@ -89,7 +89,7 @@ public class FeedDebtModelStep implements ComputationStep {
}
}
- private enum DtoToCharFunction implements Function<CharacteristicDto, Characteristic> {
+ private enum CharacteristicDtoToCharacteristic implements Function<CharacteristicDto, Characteristic> {
INSTANCE;
@Nullable
@@ -99,14 +99,14 @@ public class FeedDebtModelStep implements ComputationStep {
}
}
- private enum DtoToParentIdFunction implements Function<CharacteristicDto, Integer> {
+ private enum CharacteristicDtoToParentId implements Function<CharacteristicDto, Integer> {
INSTANCE;
@Nullable
@Override
public Integer apply(@Nonnull CharacteristicDto characteristicDto) {
Integer parentId = characteristicDto.getParentId();
- return parentId == null ? null : parentId;
+ return parentId == null ? characteristicDto.getId() : parentId;
}
}