aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/main/java
diff options
context:
space:
mode:
authorjhh <jorge.hernandez-herrero@att.com>2020-03-10 12:41:49 -0500
committerjhh <jorge.hernandez-herrero@att.com>2020-03-10 12:41:49 -0500
commit0e658768fc0573bf6acf7f849a49c9da98c8e47f (patch)
tree6126811a43d2046600c7b1ed5f5044574e4a660c /controlloop/common/eventmanager/src/main/java
parentf9e2f54dbb36f029a41e37f6eccc3426672cb9bb (diff)
Use predefined domain policies from drools core
Issue-ID: POLICY-2388 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I5948ed5152297e4addbab444ed65dcd3b8002492
Diffstat (limited to 'controlloop/common/eventmanager/src/main/java')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/processor/ControlLoopProcessor.java18
1 files changed, 9 insertions, 9 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 154462247..b6c7c8b7a 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
@@ -21,9 +21,9 @@
package org.onap.policy.controlloop.processor;
import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
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,10 +39,10 @@ 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.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.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;
import org.onap.policy.drools.system.PolicyEngineConstants;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.slf4j.Logger;
@@ -55,7 +55,7 @@ public class ControlLoopProcessor implements Serializable {
private static final Logger logger = LoggerFactory.getLogger(ControlLoopProcessor.class);
private final ControlLoopPolicy policy;
- private String currentNestedPolicyId = null;
+ private String currentNestedPolicyId;
// not serializable, thus must be transient
@Getter
@@ -99,17 +99,17 @@ public class ControlLoopProcessor implements Serializable {
this.currentNestedPolicyId = this.policy.getControlLoop().getTrigger_policy();
this.toscaOpPolicy = toscaPolicy;
- } catch (RuntimeException | CoderException | UnsupportedEncodingException e) {
+ } catch (RuntimeException | CoderException e) {
throw new ControlLoopException(e);
}
}
protected ControlLoopPolicy buildPolicyFromToscaLegacy(ToscaPolicy policy)
- throws UnsupportedEncodingException, CoderException {
+ throws CoderException {
LegacyPolicy legacyPolicy =
PolicyEngineConstants.getManager().getDomainMaker().convertTo(policy, LegacyPolicy.class);
this.domainOpPolicy = legacyPolicy;
- String decodedPolicy = URLDecoder.decode(legacyPolicy.getProperties().getContent(), "UTF-8");
+ String decodedPolicy = URLDecoder.decode(legacyPolicy.getProperties().getContent(), StandardCharsets.UTF_8);
return new Yaml(
new CustomClassLoaderConstructor(
ControlLoopPolicy.class, ControlLoopPolicy.class.getClassLoader())).load(decodedPolicy);