summaryrefslogtreecommitdiffstats
path: root/rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java
diff options
context:
space:
mode:
Diffstat (limited to 'rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java')
-rw-r--r--rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java28
1 files changed, 8 insertions, 20 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 c1f1917..6ab7576 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,7 +73,7 @@ public class RuleMgtWrapper {
if (ruleTemp != null) {
throw new CorrelationException("A rule with the same name already exists.");
}
- String packageName = deployRule2Engine(correlationRule, ruleCreateRequest.getLoopControlName());
+ String packageName = deployRule2Engine(correlationRule);
correlationRule.setPackageName(packageName);
CorrelationRule result = null;
try {
@@ -135,7 +135,10 @@ public class RuleMgtWrapper {
int oldEnabled = oldCorrelationRule.getEnabled();
String newDes = newCorrelationRule.getDescription();
String oldDes = oldCorrelationRule.getDescription();
- if (newContent.equals(oldContent) && newEnabled == oldEnabled && newDes.equals(oldDes)) {
+ String oldControlLoop = oldCorrelationRule.getClosedControlLoopName();
+ String newControlLoop = newCorrelationRule.getClosedControlLoopName();
+ if (newContent.equals(oldContent) && newEnabled == oldEnabled
+ && newDes.equals(oldDes) && newControlLoop.equals(oldControlLoop)) {
return false;
}
return true;
@@ -178,6 +181,7 @@ public class RuleMgtWrapper {
correlationRule.setCreator(userName);
correlationRule.setModifier(userName);
correlationRule.setEnabled(ruleCreateRequest.getEnabled());
+ correlationRule.setClosedControlLoopName(ruleCreateRequest.getLoopControlName());
return correlationRule;
}
@@ -192,6 +196,7 @@ public class RuleMgtWrapper {
correlationRule.setUpdateTime(new Date());
correlationRule.setModifier(modifier);
correlationRule.setName(ruleName);
+ correlationRule.setClosedControlLoopName(ruleUpdateRequest.getLoopControlName());
return correlationRule;
}
@@ -204,15 +209,6 @@ public class RuleMgtWrapper {
return "";
}
- private String deployRule2Engine(CorrelationRule correlationRule, String loopControlName)
- throws CorrelationException {
- if (engineWarpper.checkRuleFromEngine(correlationRules2CheckRule(correlationRule)) && (
- correlationRule.getEnabled() == RuleMgtConstant.STATUS_RULE_OPEN)) {
- return engineWarpper.deployEngine(correlationRules2DeployRule(correlationRule, loopControlName));
- }
- return "";
- }
-
public RuleQueryListResponse getCorrelationRuleByCondition(
RuleQueryCondition ruleQueryCondition) throws CorrelationException {
List<CorrelationRule> correlationRule = correlationRuleQueryDao
@@ -249,15 +245,7 @@ public class RuleMgtWrapper {
CorrelationDeployRule4Engine correlationDeployRule4Engine = new CorrelationDeployRule4Engine();
correlationDeployRule4Engine.setContent(correlationRule.getContent());
correlationDeployRule4Engine.setEngineId(correlationRule.getEngineID());
- return correlationDeployRule4Engine;
- }
-
- private CorrelationDeployRule4Engine correlationRules2DeployRule(
- CorrelationRule correlationRule, String loopControlName) {
- CorrelationDeployRule4Engine correlationDeployRule4Engine = new CorrelationDeployRule4Engine();
- correlationDeployRule4Engine.setContent(correlationRule.getContent());
- correlationDeployRule4Engine.setEngineId(correlationRule.getEngineID());
- correlationDeployRule4Engine.setLoopControlName(loopControlName);
+ correlationDeployRule4Engine.setLoopControlName(correlationRule.getClosedControlLoopName());
return correlationDeployRule4Engine;
}