private void importActiveRules(RulesDao rulesDao, RulesProfile profile) { for (Iterator<ActiveRule> iar = profile.getActiveRules(true).iterator(); iar.hasNext(); ) { ActiveRule activeRule = iar.next(); Rule unMarshalledRule = activeRule.getRule(); Rule matchingRuleInDb = rulesDao.getRuleByKey(unMarshalledRule.getRepositoryKey(), unMarshalledRule.getKey()); if (matchingRuleInDb == null) { LoggerFactory.getLogger(getClass()) .error( "Unable to find active rule " + unMarshalledRule.getRepositoryKey() + ":" + unMarshalledRule.getKey()); iar.remove(); continue; } activeRule.setRule(matchingRuleInDb); activeRule.setRulesProfile(profile); activeRule.getActiveRuleParams(); for (Iterator<ActiveRuleParam> irp = activeRule.getActiveRuleParams().iterator(); irp.hasNext(); ) { ActiveRuleParam activeRuleParam = irp.next(); RuleParam unMarshalledRP = activeRuleParam.getRuleParam(); RuleParam matchingRPInDb = rulesDao.getRuleParam(matchingRuleInDb, unMarshalledRP.getKey()); if (matchingRPInDb == null) { LoggerFactory.getLogger(getClass()) .error("Unable to find active rule parameter " + unMarshalledRP.getKey()); irp.remove(); continue; } activeRuleParam.setActiveRule(activeRule); activeRuleParam.setRuleParam(matchingRPInDb); } } }