diff options
Diffstat (limited to 'rulemgt/src/main/java/org')
-rw-r--r-- | rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java index 856171b..5c2a428 100644 --- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java @@ -73,10 +73,17 @@ public class RuleMgtWrapper { if (ruleTemp != null) {
throw new CorrelationException("A rule with the same name already exists.");
}
+
String packageName = deployRule2Engine(correlationRule);
DmaapService.loopControlNames.put(packageName, ruleCreateRequest.getLoopControlName());
correlationRule.setPackageName(packageName);
- CorrelationRule result = correlationRuleDao.saveRule(correlationRule);
+ CorrelationRule result = null;
+ try {
+ result = correlationRuleDao.saveRule(correlationRule);
+ } catch (CorrelationException e) {
+ engineWarpper.deleteRuleFromEngine(packageName);
+ throw new CorrelationException(e.getMessage());
+ }
RuleAddAndUpdateResponse ruleAddAndUpdateResponse = new RuleAddAndUpdateResponse();
ruleAddAndUpdateResponse.setRuleId(result.getRid());
return ruleAddAndUpdateResponse;
|