summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShiwei Tian <tian.shiwei@zte.com.cn>2017-10-12 11:08:02 +0800
committerShiwei Tian <tian.shiwei@zte.com.cn>2017-10-12 11:08:02 +0800
commit973f3377b5e3590fd0cb71b6fd8d00ffc5aa55b8 (patch)
tree25a6a997019c730867e5a2d42cfd82958be7a14f
parented614d0b1f124c5476055f137086dce111798d8e (diff)
modify deploy rule bug
Issue-ID: HOLMES-44 Change-Id: Ib8ae03aee13144638c64978d97be2caff709c038 Signed-off-by: Shiwei Tian <tian.shiwei@zte.com.cn>
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java9
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;