From 0a5d9cf30c61956e62cc7db4faf84f999a7196cc Mon Sep 17 00:00:00 2001 From: jhh Date: Fri, 21 Aug 2020 13:29:21 -0500 Subject: remove legacy operational policies support Issue-ID: POLICY-2765 Signed-off-by: jhh Change-Id: I454365943465863b108ba8668b2bc4b201986959 --- .../controlloop/processor/ControlLoopProcessor.java | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'controlloop/common/eventmanager/src/main') 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 f1835d740..f578c8a85 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 @@ -22,8 +22,6 @@ package org.onap.policy.controlloop.processor; import java.io.Serializable; import java.lang.reflect.InvocationTargetException; -import java.net.URLDecoder; -import java.nio.charset.StandardCharsets; import java.util.stream.Collectors; import lombok.Getter; import org.apache.commons.beanutils.BeanUtils; @@ -39,7 +37,6 @@ import org.onap.policy.controlloop.policy.PolicyResult; 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.domain.models.legacy.LegacyPolicy; import org.onap.policy.drools.domain.models.operational.Operation; import org.onap.policy.drools.domain.models.operational.OperationalPolicy; import org.onap.policy.drools.domain.models.operational.OperationalTarget; @@ -93,11 +90,7 @@ public class ControlLoopProcessor implements Serializable { */ public ControlLoopProcessor(ToscaPolicy toscaPolicy) throws ControlLoopException { try { - // TODO: automate policy type to models mapping - this.policy = - ("onap.policies.controlloop.Operational".equals(toscaPolicy.getType())) - ? buildPolicyFromToscaLegacy(toscaPolicy) - : buildPolicyFromToscaCompliant(toscaPolicy); + this.policy = buildPolicyFromToscaCompliant(toscaPolicy); this.currentNestedPolicyId = this.policy.getControlLoop().getTrigger_policy(); this.toscaOpPolicy = toscaPolicy; @@ -106,17 +99,6 @@ public class ControlLoopProcessor implements Serializable { } } - protected ControlLoopPolicy buildPolicyFromToscaLegacy(ToscaPolicy policy) - throws CoderException { - LegacyPolicy legacyPolicy = - PolicyEngineConstants.getManager().getDomainMaker().convertTo(policy, LegacyPolicy.class); - this.domainOpPolicy = legacyPolicy; - String decodedPolicy = URLDecoder.decode(legacyPolicy.getProperties().getContent(), StandardCharsets.UTF_8); - return new Yaml( - new CustomClassLoaderConstructor( - ControlLoopPolicy.class, ControlLoopPolicy.class.getClassLoader())).load(decodedPolicy); - } - private Target toStandardTarget(OperationalTarget opTarget) { Target target = new Target(TargetType.valueOf(opTarget.getTargetType())); try { -- cgit 1.2.3-korg