}
private TechnicalDebtModel load(CharacteristicDao dao) {
- DefaultTechnicalDebtModel model = new DefaultTechnicalDebtModel();
+ DefaultTechnicalDebtModel debtModel = new DefaultTechnicalDebtModel();
List<CharacteristicDto> dtos = dao.selectEnabledCharacteristics();
Map<Integer, DefaultCharacteristic> characteristicsById = newHashMap();
- addRootCharacteristics(model, dtos, characteristicsById);
+ addRootCharacteristics(debtModel, dtos, characteristicsById);
addCharacteristics(dtos, characteristicsById);
- return model;
+ return debtModel;
}
private void addRootCharacteristics(DefaultTechnicalDebtModel model, List<CharacteristicDto> dtos, Map<Integer, DefaultCharacteristic> characteristicsById) {
.setDescription(ruleDto.getDescription())
.setStatus(RuleStatus.valueOf(ruleDto.getStatus()));
// TODO should we set metadata ?
- if (ruleDto.getCharacteristicId() != null) {
- Characteristic characteristic = characteristic(ruleDto.getCharacteristicId(), ruleKey, debtModel);
+ Integer characteristicId = ruleDto.getCharacteristicId();
+ Integer defaultCharacteristicId = ruleDto.getDefaultCharacteristicId();
+ if (characteristicId != null) {
+ Characteristic characteristic = characteristic(characteristicId, ruleKey, debtModel);
updateRuleDebtDefinitions(newRule, ruleKey, characteristic, ruleDto.getRemediationFunction(), ruleDto.getRemediationFactor(), ruleDto.getRemediationOffset(), durations);
- } else if (ruleDto.getDefaultCharacteristicId() != null) {
- Characteristic characteristic = characteristic(ruleDto.getDefaultCharacteristicId(), ruleKey, debtModel);
+ } else if (defaultCharacteristicId != null) {
+ Characteristic characteristic = characteristic(defaultCharacteristicId, ruleKey, debtModel);
updateRuleDebtDefinitions(newRule, ruleKey, characteristic, ruleDto.getDefaultRemediationFunction(), ruleDto.getDefaultRemediationFactor(),
ruleDto.getDefaultRemediationOffset(), durations);
}
private final Integer id;
private final String name, severity, description, metadata, characteristic;
private final RuleStatus status;
- RemediationFunction function;
- Duration factor, offset;
+ private final RemediationFunction function;
+ private final Duration factor, offset;
private final Map<String, RuleParam> params;