}
private void restoreRules(List<CharacteristicDto> allCharacteristicDtos, List<RuleDto> rules, List<RuleDebt> ruleDebts,
ValidationMessages validationMessages, Date updateDate, DbSession session) {
for (RuleDto rule : rules) {
RuleDebt ruleDebt = ruleDebt(rule.getRepositoryKey(), rule.getRuleKey(), ruleDebts);
String subCharacteristicKey = ruleDebt != null ? ruleDebt.subCharacteristicKey() : null;
CharacteristicDto subCharacteristicDto = subCharacteristicKey != null ? characteristicByKey(ruleDebt.subCharacteristicKey(), allCharacteristicDtos, true) : null;
ruleOperations.updateRule(rule, subCharacteristicDto,
ruleDebt != null ? ruleDebt.function() : null,
ruleDebt != null ? ruleDebt.coefficient() : null,
ruleDebt != null ? ruleDebt.offset() : null, session);
rule.setUpdatedAt(updateDate);
ruleDebts.remove(ruleDebt);
}
for (RuleDebt ruleDebt : ruleDebts) {
validationMessages.addWarningText(String.format("The rule '%s' does not exist.", ruleDebt.ruleKey()));
}
}