summaryrefslogtreecommitdiffstats
path: root/core/core-engine/src
diff options
context:
space:
mode:
authorRam Krishna Verma <ram_krishna.verma@bell.ca>2021-08-27 16:53:11 -0400
committerAjith Sreekumar <ajith.sreekumar@bell.ca>2021-08-31 10:14:34 +0000
commit9ee4561bcd28b7199fd1ffed118f122a8435203a (patch)
tree49f07ddc8d082f6028fb53dbfcfeb654b79a55a3 /core/core-engine/src
parent795bd98b7459fd677e06354ea054c8922821522b (diff)
Fix sonar issues in apex-pdp
Issue-ID: POLICY-3077 Change-Id: Id5e7c2ddada2bac3b73fe543f9adade6f9b83e6c Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
Diffstat (limited to 'core/core-engine/src')
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java6
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java3
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java3
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java3
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java11
5 files changed, 15 insertions, 11 deletions
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java
index 3f6d6cfe6..6cbc04678 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java
@@ -93,7 +93,7 @@ public class StateMachineExecutor implements Executor<EnEvent, Collection<EnEven
StateExecutor lastExecutor = null;
for (final AxState state : axPolicy.getStateMap().values()) {
// Create a state executor for this state and add its context (the state)
- final StateExecutor stateExecutor = new StateExecutor(executorFactory);
+ final var stateExecutor = new StateExecutor(executorFactory);
stateExecutor.setContext(this, state, internalContext);
// Update the next executor on the last executor
@@ -140,8 +140,8 @@ public class StateMachineExecutor implements Executor<EnEvent, Collection<EnEven
// Get the first state of the state machine and define a state output that starts state
// execution
- StateExecutor stateExecutor = firstExecutor;
- StateOutput stateOutput = new StateOutput(new AxStateOutput(firstExecutor.getSubject().getKey(),
+ var stateExecutor = firstExecutor;
+ var stateOutput = new StateOutput(new AxStateOutput(firstExecutor.getSubject().getKey(),
incomingEvent.getKey(), firstExecutor.getSubject().getKey()), incomingEvent);
while (true) {
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
index eb5f5f35d..12e350390 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020-2021 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -150,7 +151,7 @@ public class StateFinalizerExecutionContext extends AbstractExecutionContext {
*/
public ContextAlbum getContextAlbum(final String contextAlbumName) {
// Find the context album
- final ContextAlbum foundContextAlbum = context.get(contextAlbumName);
+ final var foundContextAlbum = context.get(contextAlbumName);
// Check if the context album exists
if (foundContextAlbum != null) {
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java
index 69d51c45a..c79e907d9 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/TaskSelectionExecutionContext.java
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -138,7 +139,7 @@ public class TaskSelectionExecutionContext extends AbstractExecutionContext {
*/
public ContextAlbum getContextAlbum(final String contextAlbumName) {
// Find the context album
- final ContextAlbum foundContextAlbum = context.get(contextAlbumName);
+ final var foundContextAlbum = context.get(contextAlbumName);
// Check if the context album exists
if (foundContextAlbum != null) {
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java
index e37d074b6..9dc841f48 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/impl/ExecutorFactoryImpl.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -117,7 +118,7 @@ public class ExecutorFactoryImpl implements ExecutorFactory {
public TaskExecutor getTaskExecutor(final Executor<?, ?, ?, ?> parentExecutor, final AxTask task,
final ApexInternalContext context) {
// Create task executor
- final TaskExecutor taskExecutor = (TaskExecutor) createExecutor(task.getTaskLogic().getLogicFlavour(),
+ final var taskExecutor = (TaskExecutor) createExecutor(task.getTaskLogic().getLogicFlavour(),
taskExecutorPluginClassMap.get(task.getTaskLogic().getLogicFlavour()), TaskExecutor.class);
taskExecutor.setParameters(implementationParameterMap.get(task.getTaskLogic().getLogicFlavour()));
taskExecutor.setContext(parentExecutor, task, context);
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java
index de2639dcb..ca564ca81 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/monitoring/EventMonitor.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +45,7 @@ public class EventMonitor {
* @param userArtifactStack the keys of the artifacts using the event at the moment
*/
public void monitorGet(final AxField eventParameter, final Object value, final AxConcept[] userArtifactStack) {
- String monitorGetString = monitor("GET", userArtifactStack, eventParameter, value);
+ var monitorGetString = monitor("GET", userArtifactStack, eventParameter, value);
LOGGER.trace(monitorGetString);
}
@@ -56,7 +57,7 @@ public class EventMonitor {
* @param userArtifactStack the keys of the artifacts using the event at the moment
*/
public void monitorSet(final AxField eventParameter, final Object value, final AxConcept[] userArtifactStack) {
- String monitorSetString = monitor("SET", userArtifactStack, eventParameter, value);
+ var monitorSetString = monitor("SET", userArtifactStack, eventParameter, value);
LOGGER.trace(monitorSetString);
}
@@ -69,7 +70,7 @@ public class EventMonitor {
*/
public void monitorRemove(final AxField eventParameter, final Object removedValue,
final AxConcept[] userArtifactStack) {
- String monitorRemoveString = monitor("REMOVE", userArtifactStack, eventParameter, removedValue);
+ var monitorRemoveString = monitor("REMOVE", userArtifactStack, eventParameter, removedValue);
LOGGER.trace(monitorRemoveString);
}
@@ -84,13 +85,13 @@ public class EventMonitor {
*/
private String monitor(final String preamble, final AxConcept[] userArtifactStack, final AxField eventParameter,
final Object value) {
- final StringBuilder builder = new StringBuilder();
+ final var builder = new StringBuilder();
builder.append(preamble);
builder.append(",[");
if (userArtifactStack != null) {
- boolean first = true;
+ var first = true;
for (final AxConcept stackKey : userArtifactStack) {
if (first) {
first = false;