public static void saveOrUpdate(RuleModel ruleModel) { if (!ruleModel.isEchoOnly()) { RulesDao.saveOrUpdateRule(ruleModel.toRule()); if (!ruleModel.getEcho()) { EchoParametersDao.deleteEchoParameters(ruleModel.getId()); } } if (ruleModel.getEcho() || ruleModel.isEchoOnly()) { EchoParametersDao.saveOrUpdateEchoParameter(ruleModel.toEchoParameter()); } }
public static List<RuleModel> getRulesModels() { List<RuleModel> ruleModels = RulesDao.getRules().stream().map(RuleModel::new).collect(Collectors.toList()); EchoParametersDao.getEchoParameters() .forEach(forwardParameter -> mergedForwardParameter(ruleModels, forwardParameter)); return ruleModels; }
public static void delete(String... rulesIds) { RulesDao.deleteRules(rulesIds); EchoParametersDao.deleteEchoParameters(rulesIds); }