Timer timer = new Timer("Db Migration Progress");
timer.schedule(progressTask, MassUpdate.ProgressTask.PERIOD_MS, MassUpdate.ProgressTask.PERIOD_MS);
DbSession session = db.openSession(false);
try {
Migration45Mapper mapper = session.getMapper(Migration45Mapper.class);
List<RuleParameter> templateRuleParams = mapper.selectAllTemplateRuleParameters();
Multimap<Integer, RuleParameter> templateRuleParamsByRuleId = ArrayListMultimap.create();
for (RuleParameter templateRuleParam : templateRuleParams) {
templateRuleParamsByRuleId.put(templateRuleParam.getRuleId(), templateRuleParam);
}
List<Rule> customRules = mapper.selectAllCustomRules();
Multimap<Integer, Integer> customRuleIdsByTemplateRuleId = HashMultimap.create();
for (Rule customRule : customRules) {
customRuleIdsByTemplateRuleId.put(customRule.getTemplateId(), customRule.getId());
}
List<RuleParameter> customRuleParams = mapper.selectAllCustomRuleParameters();
Multimap<Integer, RuleParameter> customRuleParamsByRuleId = ArrayListMultimap.create();
for (RuleParameter customRuleParam : customRuleParams) {
customRuleParamsByRuleId.put(customRuleParam.getRuleId(), customRuleParam);
}