aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java39
1 files changed, 27 insertions, 12 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
index 0015e4dd7..4ef1f75c9 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java
@@ -40,6 +40,7 @@ import org.onap.policy.controlloop.policy.Target;
import org.onap.policy.controlloop.policy.TargetType;
import org.onap.policy.drools.domain.models.DroolsPolicy;
import org.onap.policy.drools.models.domain.legacy.LegacyPolicy;
+import org.onap.policy.drools.models.domain.operational.Operation;
import org.onap.policy.drools.models.domain.operational.OperationalPolicy;
import org.onap.policy.drools.models.domain.operational.OperationalTarget;
import org.onap.policy.drools.system.PolicyEngineConstants;
@@ -131,18 +132,7 @@ public class ControlLoopProcessor implements Serializable {
// @formatter:off
backwardsCompatiblePolicy.setPolicies(
- domainPolicy.getProperties().getOperations().stream().map(operation -> new Policy(
- PolicyParam.builder()
- .id(operation.getId())
- .name(operation.getActorOperation().getOperation())
- .description(operation.getDescription())
- .actor(operation.getActorOperation().getActor())
- .payload(operation.getActorOperation().getPayload())
- .recipe(operation.getActorOperation().getOperation())
- .retries(operation.getRetries())
- .timeout(operation.getTimeout())
- .target(toStandardTarget(operation.getActorOperation().getTarget()))
- .build()))
+ domainPolicy.getProperties().getOperations().stream().map(this::convertPolicy)
.collect(Collectors.toList()));
// @formatter:on
@@ -158,6 +148,31 @@ public class ControlLoopProcessor implements Serializable {
return backwardsCompatiblePolicy;
}
+ private Policy convertPolicy(Operation operation) {
+ // @formatter:off
+ Policy newPolicy = new Policy(PolicyParam.builder()
+ .id(operation.getId())
+ .name(operation.getActorOperation().getOperation())
+ .description(operation.getDescription())
+ .actor(operation.getActorOperation().getActor())
+ .payload(operation.getActorOperation().getPayload())
+ .recipe(operation.getActorOperation().getOperation())
+ .retries(operation.getRetries())
+ .timeout(operation.getTimeout())
+ .target(toStandardTarget(operation.getActorOperation().getTarget()))
+ .build());
+ // @formatter:on
+
+ newPolicy.setSuccess(operation.getSuccess());
+ newPolicy.setFailure(operation.getFailure());
+ newPolicy.setFailure_exception(operation.getFailureException());
+ newPolicy.setFailure_guard(operation.getFailureGuard());
+ newPolicy.setFailure_retries(operation.getFailureRetries());
+ newPolicy.setFailure_timeout(operation.getFailureTimeout());
+
+ return newPolicy;
+ }
+
/**
* Get ControlLoopParams.
*/