private RuleUpdate createRuleUpdate(RuleKey key) {
Rule rule = service.getByKey(key);
if (rule == null) {
throw new NotFoundException("This rule does not exists : " + key);
}
if (rule.templateKey() != null) {
return RuleUpdate.createForCustomRule(key);
} else if (rule.isManual()) {
return RuleUpdate.createForManualRule(key);
} else {
return RuleUpdate.createForPluginRule(key);