summaryrefslogtreecommitdiffstats
path: root/core/core-engine/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-08-03 14:08:09 -0400
committerJim Hahn <jrh3@att.com>2021-08-06 15:14:31 -0400
commit0ed6c16727aa92c93965a7da756536b113b262c8 (patch)
treef7961bccd0db40a9f9985a5936381f183432235c /core/core-engine/src
parent9344ec1396b7151262e9b4ac48c72020e2b03e7e (diff)
Use lombok for apex-pdp #7
Updated thru core-protocols. Issue-ID: POLICY-3391 Change-Id: I2226fee16b276eba5c7f3fd1921a6cef36654f07 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'core/core-engine/src')
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java15
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java60
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java9
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java12
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java20
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java30
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java74
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java30
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java11
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java22
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutor.java11
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java10
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java21
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java12
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java12
-rw-r--r--core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/StateFinalizerExecutionContext.java22
16 files changed, 76 insertions, 295 deletions
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java
index 1ac0ef6c2..3cd283b74 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/EngineParameterConstants.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.
@@ -20,18 +21,14 @@
package org.onap.policy.apex.core.engine;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
/**
* This class holds constants used when managing engine parameter groups in apex.
*/
-public abstract class EngineParameterConstants {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class EngineParameterConstants {
public static final String MAIN_GROUP_NAME = "ENGINE_PARAMETERS";
public static final String EXECUTOR_GROUP_NAME = "EXECUTOR_PARAMETERS";
-
- /**
- * Private default constructor to prevent subclassing.
- */
- private EngineParameterConstants() {
- // Prevents subclassing
- }
-
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java
index 7bff07d9a..f7dc5dd0b 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/ExecutorParameters.java
@@ -21,6 +21,8 @@
package org.onap.policy.apex.core.engine;
+import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.common.parameters.ParameterGroupImpl;
/**
@@ -32,6 +34,8 @@ import org.onap.policy.common.parameters.ParameterGroupImpl;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@Getter
+@Setter
public class ExecutorParameters extends ParameterGroupImpl {
// Executor Plugin classes for executors
private String taskExecutorPluginClass;
@@ -46,62 +50,6 @@ public class ExecutorParameters extends ParameterGroupImpl {
super(EngineParameterConstants.EXECUTOR_GROUP_NAME);
}
- /**
- * Gets the task executor plugin class for the executor.
- *
- * @return the task executor plugin class for the executor
- */
- public String getTaskExecutorPluginClass() {
- return taskExecutorPluginClass;
- }
-
- /**
- * Sets the task executor plugin class for the executor.
- *
- * @param taskExecutorPluginClass the task executor plugin class for the executor
- */
- public void setTaskExecutorPluginClass(final String taskExecutorPluginClass) {
- this.taskExecutorPluginClass = taskExecutorPluginClass;
- }
-
- /**
- * Gets the task selection executor plugin class for the executor.
- *
- * @return the task selection executor plugin class for the executor
- */
- public String getTaskSelectionExecutorPluginClass() {
- return taskSelectionExecutorPluginClass;
- }
-
- /**
- * Sets the task selection executor plugin class for the executor.
- *
- * @param taskSelectionExecutorPluginClass the task selection executor plugin class for the
- * executor
- */
- public void setTaskSelectionExecutorPluginClass(final String taskSelectionExecutorPluginClass) {
- this.taskSelectionExecutorPluginClass = taskSelectionExecutorPluginClass;
- }
-
- /**
- * Gets the state finalizer executor plugin class for the executor.
- *
- * @return the state finalizer executor plugin class for the executor
- */
- public String getStateFinalizerExecutorPluginClass() {
- return stateFinalizerExecutorPluginClass;
- }
-
- /**
- * Sets the state finalizer executor plugin class for the executor.
- *
- * @param stateFinalizerExecutorPluginClass the state finalizer executor plugin class for the
- * executor
- */
- public void setStateFinalizerExecutorPluginClass(final String stateFinalizerExecutorPluginClass) {
- this.stateFinalizerExecutorPluginClass = stateFinalizerExecutorPluginClass;
- }
-
@Override
public String toString() {
return "ExecutorParameters [name=" + getName() + ", taskExecutorPluginClass=" + taskExecutorPluginClass
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java
index 2bb3dc19a..248110419 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/TaskParameters.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.
@@ -21,6 +22,7 @@
package org.onap.policy.apex.core.engine;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
import org.onap.policy.common.parameters.BeanValidator;
import org.onap.policy.common.parameters.ValidationResult;
@@ -34,8 +36,9 @@ import org.onap.policy.common.parameters.annotations.NotNull;
*/
@Getter
@Setter
+@NoArgsConstructor
public class TaskParameters {
- private String name;
+ private String name = "taskParameters";
// If taskId is not specified, then the taskParameter is added to all tasks in the engine.
private String taskId;
@@ -47,10 +50,6 @@ public class TaskParameters {
@NotBlank
private String value;
- public TaskParameters() {
- this.name = "taskParameters";
- }
-
/**
* Full constructor.
*
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java
index 0589e8311..1fee1971e 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/context/ApexInternalContext.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.
@@ -28,6 +29,7 @@ import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.Set;
import java.util.TreeMap;
+import lombok.Getter;
import org.onap.policy.apex.context.ContextAlbum;
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.context.Distributor;
@@ -52,6 +54,7 @@ import org.onap.policy.apex.model.utilities.comparison.KeyedMapDifference;
*/
public class ApexInternalContext implements AxConceptGetter<ContextAlbum> {
// The key of the currently running Apex model
+ @Getter
private AxArtifactKey key;
// The context albums being used in this engine
@@ -90,15 +93,6 @@ public class ApexInternalContext implements AxConceptGetter<ContextAlbum> {
}
/**
- * Get the key of the internal context, which is the same as the key of the engine.
- *
- * @return the key
- */
- public AxArtifactKey getKey() {
- return key;
- }
-
- /**
* Get the context albums of the engine.
*
* @return the context albums
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java
index e01feb730..cba2dc9f6 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineConstants.java
@@ -1,30 +1,35 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
package org.onap.policy.apex.core.engine.engine.impl;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
/**
* Constants for the Apex engine.
*
*/
-public abstract class ApexEngineConstants {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ApexEngineConstants {
/**
* The amount of milliseconds to wait for the current Apex engine to timeout on engine stop
* requests. If the timeout is exceeded, the stop aborts.
@@ -33,11 +38,4 @@ public abstract class ApexEngineConstants {
/** The wait increment (or pause time) when waiting for the Apex engine to stop. */
public static final int APEX_ENGINE_STOP_EXECUTION_WAIT_INCREMENT = 100;
-
- /**
- * Private constructor to prevent subclassing.
- */
- private ApexEngineConstants() {
- // Constructor to avoid subclassing
- }
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
index d45be9652..0d9d34d39 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImpl.java
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.
@@ -31,6 +32,7 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
+import lombok.Getter;
import org.onap.policy.apex.context.ContextAlbum;
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.core.engine.context.ApexInternalContext;
@@ -76,9 +78,11 @@ public class ApexEngineImpl implements ApexEngine {
private static final String STOP = "stop()<-";
// The artifact key of this engine
+ @Getter
private final AxArtifactKey key;
// The state of this engine
+ @Getter
private AxEngineState state = AxEngineState.STOPPED;
private final Object stateLockObj = new Object();
@@ -86,6 +90,7 @@ public class ApexEngineImpl implements ApexEngine {
private final Map<String, EnEventListener> eventListeners = new LinkedHashMap<>();
// The context of this engine
+ @Getter
private ApexInternalContext internalContext = null;
// The state machines
@@ -446,22 +451,6 @@ public class ApexEngineImpl implements ApexEngine {
* {@inheritDoc}.
*/
@Override
- public AxArtifactKey getKey() {
- return key;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public final AxEngineState getState() {
- return state;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxEngineModel getEngineStatus() {
final var engineModel = new AxEngineModel(key);
engineModel.setTimestamp(System.currentTimeMillis());
@@ -490,15 +479,6 @@ public class ApexEngineImpl implements ApexEngine {
}
/**
- * Get the internal context for the Apex engine.
- *
- * @return The Apex Internal Context
- */
- public ApexInternalContext getInternalContext() {
- return internalContext;
- }
-
- /**
* Create an exception event from the incoming event including the exception information on the event.
*
* @param incomingEvent The incoming event that caused the exception
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
index d4b212421..29802e06d 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnEvent.java
@@ -31,6 +31,8 @@ import java.util.Map;
import java.util.Properties;
import java.util.Random;
import java.util.Set;
+import lombok.AccessLevel;
+import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.onap.policy.apex.core.engine.monitoring.EventMonitor;
@@ -49,6 +51,9 @@ import org.slf4j.ext.XLoggerFactory;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@Getter
+@Setter
+@EqualsAndHashCode(callSuper = true, onlyExplicitlyIncluded = true)
public class EnEvent extends HashMap<String, Object> {
private static final long serialVersionUID = 6311863111866294637L;
@@ -58,37 +63,31 @@ public class EnEvent extends HashMap<String, Object> {
// Repeasted string constants
private static final String NULL_KEYS_ILLEGAL = "null keys are illegal on method parameter \"key\"";
+ /*
+ * This is not used for encryption/security, thus disabling sonar.
+ */
+ private static Random rand = new Random(System.nanoTime()); // NOSONAR
+
// The definition of this event in the Apex model
+ @Setter(AccessLevel.NONE)
+ @EqualsAndHashCode.Include
private final AxEvent axEvent;
// The event monitor for this event
+ @Getter(AccessLevel.NONE)
private final transient EventMonitor eventMonitor = new EventMonitor();
// The stack of execution of this event, used for monitoring
- @Getter
- @Setter
private AxConcept[] userArtifactStack;
- /*
- * This is not used for encryption/security, thus disabling sonar.
- */
- private static Random rand = new Random(System.nanoTime()); // NOSONAR
-
// An identifier for the current event execution. The default value here will always be a random
- // number, and should
- // be reset
- @Getter
- @Setter
+ // number, and should be reset
private long executionId = rand.nextLong();
// Event related properties used during processing of this event
- @Getter
- @Setter
private Properties executionProperties = new Properties();
// A string holding a message that indicates why processing of this event threw an exception
- @Getter
- @Setter
private String exceptionMessage;
/**
@@ -116,15 +115,6 @@ public class EnEvent extends HashMap<String, Object> {
}
/**
- * Gets the event definition of this event.
- *
- * @return the event definition
- */
- public AxEvent getAxEvent() {
- return axEvent;
- }
-
- /**
* Get the name of the event.
*
* @return the event name
@@ -298,40 +288,4 @@ public class EnEvent extends HashMap<String, Object> {
return "EnEvent [axEvent=" + axEvent + ", userArtifactStack=" + Arrays.toString(userArtifactStack) + ", map="
+ super.toString() + "]";
}
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + axEvent.hashCode();
- return result;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!super.equals(obj)) {
- return false;
- }
- if (!(obj instanceof EnEvent)) {
- return false;
- }
- EnEvent other = (EnEvent) obj;
- if (axEvent == null) {
- if (other.axEvent != null) {
- return false;
- }
- } else if (!axEvent.equals(other.axEvent)) {
- return false;
- }
- return true;
- }
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java
index 63a45fee2..99a95cae1 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/event/EnField.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.
@@ -21,6 +22,7 @@
package org.onap.policy.apex.core.engine.event;
import java.io.Serializable;
+import lombok.Getter;
import org.onap.policy.apex.context.ContextRuntimeException;
import org.onap.policy.apex.context.SchemaHelper;
import org.onap.policy.apex.context.impl.schema.SchemaHelperFactory;
@@ -34,6 +36,7 @@ import org.slf4j.ext.XLoggerFactory;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@Getter
public class EnField implements Serializable {
private static final long serialVersionUID = -5713525780081840333L;
@@ -72,24 +75,6 @@ public class EnField implements Serializable {
}
/**
- * Gets the field definition of this field.
- *
- * @return the field definition
- */
- public AxField getAxField() {
- return axField;
- }
-
- /**
- * Gets the schema helper of this field.
- *
- * @return the schema helper for this field
- */
- public SchemaHelper getSchemaHelper() {
- return schemaHelper;
- }
-
- /**
* Get the name of the field.
*
* @return the field name
@@ -108,15 +93,6 @@ public class EnField implements Serializable {
}
/**
- * Get the value of the field.
- *
- * @return the value
- */
- public Object getValue() {
- return value;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java
index 11d0aa1c9..5fb51ca70 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateExecutor.java
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.
@@ -27,6 +28,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.TreeMap;
+import lombok.Getter;
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.core.engine.ExecutorParameters;
import org.onap.policy.apex.core.engine.context.ApexInternalContext;
@@ -58,6 +60,7 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
// Hold the state and context definitions for this state
private AxState axState = null;
+ @Getter
private Executor<?, ?, ?, ?> parent = null;
private ApexInternalContext context = null;
@@ -300,14 +303,6 @@ public class StateExecutor implements Executor<EnEvent, StateOutput, AxState, Ap
* {@inheritDoc}.
*/
@Override
- public Executor<?, ?, ?, ?> getParent() {
- return parent;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxState getSubject() {
return axState;
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java
index 5f9951813..f490a9849 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/StateFinalizerExecutor.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.
@@ -25,6 +26,8 @@ import static org.onap.policy.common.utils.validation.Assertions.argumentOfClass
import java.util.Map;
import java.util.Properties;
+import lombok.AccessLevel;
+import lombok.Getter;
import lombok.NonNull;
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.core.engine.ExecutorParameters;
@@ -53,6 +56,7 @@ public abstract class StateFinalizerExecutor
private static final String EXECUTE_POST_SFL = "execute-post: state finalizer logic \"";
// Hold the state and context definitions
+ @Getter
private Executor<?, ?, ?, ?> parent = null;
private AxState axState = null;
private AxStateFinalizerLogic finalizerLogic = null;
@@ -67,18 +71,10 @@ public abstract class StateFinalizerExecutor
// The execution context; contains the facades for events and context to be used by tasks
// executed by this task
// executor
+ @Getter(AccessLevel.PROTECTED)
private StateFinalizerExecutionContext executionContext = null;
/**
- * Gets the execution internalContext.
- *
- * @return the execution context
- */
- protected StateFinalizerExecutionContext getExecutionContext() {
- return executionContext;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
@@ -181,14 +177,6 @@ public abstract class StateFinalizerExecutor
* {@inheritDoc}.
*/
@Override
- public Executor<?, ?, ?, ?> getParent() {
- return parent;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxStateFinalizerLogic getSubject() {
return finalizerLogic;
}
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 52429a215..3f6d6cfe6 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
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.
@@ -27,6 +28,7 @@ import java.util.Collections;
import java.util.Map;
import java.util.Properties;
import java.util.TreeMap;
+import lombok.Getter;
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.core.engine.ExecutorParameters;
import org.onap.policy.apex.core.engine.context.ApexInternalContext;
@@ -47,6 +49,7 @@ import org.onap.policy.apex.model.policymodel.concepts.AxStateOutput;
public class StateMachineExecutor implements Executor<EnEvent, Collection<EnEvent>, AxPolicy, ApexInternalContext> {
// The Apex Policy and context for this state machine
private AxPolicy axPolicy = null;
+ @Getter
private Executor<?, ?, ?, ?> parent = null;
private ApexInternalContext internalContext = null;
@@ -202,14 +205,6 @@ public class StateMachineExecutor implements Executor<EnEvent, Collection<EnEven
* {@inheritDoc}.
*/
@Override
- public final Executor<?, ?, ?, ?> getParent() {
- return parent;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public final AxPolicy getSubject() {
return axPolicy;
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java
index 31e27d244..ed5c0f271 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/TaskExecutor.java
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.
@@ -60,6 +61,7 @@ public abstract class TaskExecutor
private static final XLogger LOGGER = XLoggerFactory.getXLogger(TaskExecutor.class);
// Hold the task and context definitions for this task
+ @Getter
private Executor<?, ?, ?, ?> parent = null;
private AxTask axTask = null;
private ApexInternalContext internalContext = null;
@@ -277,14 +279,6 @@ public abstract class TaskExecutor
* {@inheritDoc}.
*/
@Override
- public Executor<?, ?, ?, ?> getParent() {
- return parent;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxTask getSubject() {
return axTask;
}
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java
index 527673108..3e6d13023 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AbstractExecutionContext.java
@@ -23,6 +23,7 @@ package org.onap.policy.apex.core.engine.executor.context;
import java.util.Properties;
import lombok.Getter;
+import lombok.RequiredArgsConstructor;
import lombok.Setter;
import org.onap.policy.apex.context.SchemaHelper;
import org.onap.policy.common.utils.coder.CoderException;
@@ -34,6 +35,7 @@ import org.onap.policy.common.utils.coder.StandardCoder;
* policy, global, and external context.
*/
@Getter
+@RequiredArgsConstructor
public class AbstractExecutionContext {
/** A constant <code>boolean true</code> value available for reuse e.g., for the return value */
public static final Boolean IS_TRUE = true;
@@ -43,12 +45,12 @@ public class AbstractExecutionContext {
*/
public static final Boolean IS_FALSE = false;
- /** the execution ID for the current APEX policy execution instance. */
- public final Long executionId;
-
// Standard coder for JSON converts
private static final StandardCoder STANDARD_CODER = new StandardCoder();
+ /** the execution ID for the current APEX policy execution instance. */
+ public final Long executionId;
+
// A message specified in the logic
@Setter
private String message;
@@ -57,19 +59,6 @@ public class AbstractExecutionContext {
private final Properties executionProperties;
/**
- * Instantiates a new task execution context.
- *
- * @param executionId the execution ID for the current APEX policy execution instance
- * @param executionProperties the execution properties for task execution
- */
- public AbstractExecutionContext(final long executionId, final Properties executionProperties) {
-
- // Execution ID is the current policy execution instance
- this.executionId = executionId;
- this.executionProperties = executionProperties;
- }
-
- /**
* Get a JSON representation of an object.
*
* @param theObject the object to get a JSON representation of
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java
index f433eedcd..75d2aa82f 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxStateFacade.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.
@@ -24,6 +25,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
+import lombok.AllArgsConstructor;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.service.ModelService;
import org.onap.policy.apex.model.policymodel.concepts.AxState;
@@ -35,6 +37,7 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTasks;
*
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
*/
+@AllArgsConstructor
public class AxStateFacade {
// CHECKSTYLE:OFF: checkstyle:visibilityModifier Logic has access to this field
@@ -44,15 +47,6 @@ public class AxStateFacade {
// CHECKSTYLE:ON: checkstyle:visibilityModifier
/**
- * Instantiates a new AxState facade.
- *
- * @param state the state for which a facade is being presented
- */
- public AxStateFacade(final AxState state) {
- this.state = state;
- }
-
- /**
* Gets the default task key of the state.
*
* @return the default task key
diff --git a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java
index 5f39bcd56..8a310c616 100644
--- a/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java
+++ b/core/core-engine/src/main/java/org/onap/policy/apex/core/engine/executor/context/AxTaskFacade.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.
@@ -21,6 +22,7 @@
package org.onap.policy.apex.core.engine.executor.context;
+import lombok.AllArgsConstructor;
import org.onap.policy.apex.context.SchemaHelper;
import org.onap.policy.apex.context.impl.schema.SchemaHelperFactory;
import org.onap.policy.apex.core.engine.event.EnException;
@@ -36,6 +38,7 @@ import org.slf4j.ext.XLoggerFactory;
*
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
*/
+@AllArgsConstructor
public class AxTaskFacade {
// Logger for this class
private static final XLogger LOGGER = XLoggerFactory.getXLogger(AxTaskFacade.class);
@@ -51,15 +54,6 @@ public class AxTaskFacade {
// CHECKSTYLE:ON: checkstyle:visibilityModifier
/**
- * Instantiates a new AxTask facade.
- *
- * @param task the task for which a facade is being presented
- */
- public AxTaskFacade(final AxTask task) {
- this.task = task;
- }
-
- /**
* Gets the name of the task.
*
* @return the task name
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 6b2576d90..eb5f5f35d 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
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* 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.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +29,7 @@ import java.util.Properties;
import java.util.Set;
import java.util.TreeMap;
import lombok.Getter;
+import lombok.Setter;
import org.onap.policy.apex.context.ContextAlbum;
import org.onap.policy.apex.context.ContextRuntimeException;
import org.onap.policy.apex.core.engine.context.ApexInternalContext;
@@ -76,6 +78,8 @@ public class StateFinalizerExecutionContext extends AbstractExecutionContext {
* The state output that the state finalizer logic has selected for a state. The state finalizer logic sets this
* field in its logic after executing and the Apex engine uses this state output for this state.
*/
+ @Getter
+ @Setter
private String selectedStateOutputName;
/**
@@ -156,22 +160,4 @@ public class StateFinalizerExecutionContext extends AbstractExecutionContext {
+ "\" on state \"" + subject.getId() + "\"");
}
}
-
- /**
- * Return the state output name selected by the state finalizer logic.
- *
- * @return the state output name
- */
- public String getSelectedStateOutputName() {
- return selectedStateOutputName;
- }
-
- /**
- * Set the state output name selected by the state finalizer logic.
- *
- * @param selectedStateOutputName the state output name
- */
- public void setSelectedStateOutputName(final String selectedStateOutputName) {
- this.selectedStateOutputName = selectedStateOutputName;
- }
}