/*-
* ============LICENSE_START=======================================================
* 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.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.Properties;
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;
import org.slf4j.ext.XLoggerFactory;
/**
- * Container class for the execution context for Task Selection logic executions in a task being
- * executed in an Apex engine. The task must have easy access to the state definition, the incoming
- * and outgoing event contexts, as well as the policy, global, and external context.
+ * Container class for the execution context for Task Selection logic executions in a task being executed in an Apex
+ * engine. The task must have easy access to the state definition, the incoming and outgoing event contexts, as well as
+ * the policy, global, and external context.
*
* @author Sven van der Meer (sven.van.der.meer@ericsson.com)
*/
-public class TaskSelectionExecutionContext {
+@Getter
+public class TaskSelectionExecutionContext extends AbstractExecutionContext {
// Logger for task execution
private static final XLogger EXECUTION_LOGGER =
XLoggerFactory.getXLogger("org.onap.policy.apex.executionlogging.TaskSelectionExecutionLogging");
// CHECKSTYLE:OFF: checkstyle:VisibilityModifier Logic has access to these field
- /** A constant <code>boolean true</code> value available for reuse e.g., for the return value */
- public final Boolean isTrue = true;
-
- /**
- * A constant <code>boolean false</code> value available for reuse e.g., for the return value
- */
- public final Boolean isFalse = false;
-
/** A facade to the full state definition for the task selection logic being executed. */
public final AxStateFacade subject;
- /** the execution ID for the current APEX policy execution instance. */
- public final Long executionId;
-
/**
- * The incoming fields from the trigger event for the state. The task selection logic can access
- * these fields to decide what task to select for the state.
+ * The incoming fields from the trigger event for the state. The task selection logic can access these fields to
+ * decide what task to select for the state.
*/
public final Map<String, Object> inFields;
/**
- * The task that the task selection logic has selected for a state. The task selection logic
- * sets this field in its logic prior to executing and the Apex engine executes this task as the
- * task for this state.
+ * The task that the task selection logic has selected for a state. The task selection logic sets this field in its
+ * logic prior to executing and the Apex engine executes this task as the task for this state.
*/
public final AxArtifactKey selectedTask;
/**
- * Logger for task selection execution, task selection logic can use this field to access and
- * log to Apex logging.
+ * Logger for task selection execution, task selection logic can use this field to access and log to Apex logging.
*/
public final XLogger logger = EXECUTION_LOGGER;
// All available context albums
private final Map<String, ContextAlbum> context;
- // A message specified in the logic
- @Getter
- @Setter
- private String message;
-
- // Execution properties for a policy execution
- @Getter
- private Properties executionProperties;
-
/**
* Instantiates a new task selection execution context.
*
* @param axState the state definition that is the subject of execution
* @param incomingEvent the incoming event for the state
* @param outgoingKey the outgoing key for the task to execute in this state
- * @param internalContext the execution context of the Apex engine in which the task is being
- * executed
+ * @param internalContext the execution context of the Apex engine in which the task is being executed
*/
public TaskSelectionExecutionContext(final TaskSelectExecutor taskSelectExecutor, final long executionId,
final AxState axState, final EnEvent incomingEvent, final AxArtifactKey outgoingKey,
final ApexInternalContext internalContext) {
+ super(executionId, incomingEvent.getExecutionProperties());
// The subject is the state definition
subject = new AxStateFacade(axState);
- // Execution ID is the current policy execution instance
- this.executionId = executionId;
- this.executionProperties = incomingEvent.getExecutionProperties();
-
// The events
inFields = incomingEvent;
selectedTask = outgoingKey;
*
* @param contextAlbumName The context album name
* @return The context albumxxxxxx
- * @throws ContextRuntimeException if the context album does not exist on the state for this
- * executor
+ * @throws ContextRuntimeException if the context album does not exist on the state for this executor
*/
public ContextAlbum getContextAlbum(final String contextAlbumName) {
// Find the context album