2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * Modifications Copyright (C) 2022 Nordix Foundation.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.apex.model.policymodel.concepts;
24 import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
27 * This class holds Task Selection Logic for {@link AxState} states in Apex. It is a specialization
28 * of the {@link AxLogic} class, so that Task Selection Logic in Apex states can be strongly typed.
30 * <p>Task Selection Logic is used to select the task {@link AxTask} that a state will execute. The
31 * logic uses fields on the incoming trigger event and information from the context albums available
32 * on a state to decide what task {@link AxTask} to select for execution in a given context.
34 * <p>Validation uses standard Apex Logic validation, see validation in {@link AxLogic}.
36 public class AxTaskSelectionLogic extends AxLogic {
37 private static final long serialVersionUID = 2090324845463750391L;
40 * The Default Constructor creates a logic instance with a null key, undefined logic flavour and
41 * a null logic string.
43 public AxTaskSelectionLogic() {
48 * The Key Constructor creates a logic instance with the given reference key, undefined logic
49 * flavour and a null logic string.
51 * @param key the reference key of the logic
53 public AxTaskSelectionLogic(final AxReferenceKey key) {
54 super(key, LOGIC_FLAVOUR_UNDEFINED, "");
58 * This Constructor creates a logic instance with a reference key constructed from the parents
59 * key and the logic local name and all of its fields defined.
61 * @param parentKey the reference key of the parent of this logic
62 * @param logicName the logic name, held as the local name of the reference key of this logic
63 * @param logicFlavour the flavour of this logic
64 * @param logic the actual logic as a string
66 public AxTaskSelectionLogic(final AxReferenceKey parentKey, final String logicName, final String logicFlavour,
68 super(parentKey, logicName, logicFlavour, logic);
72 * This Constructor creates a logic instance with the given reference key and all of its fields
75 * @param key the reference key of this logic
76 * @param logicFlavour the flavour of this logic
77 * @param logic the actual logic as a string
79 public AxTaskSelectionLogic(final AxReferenceKey key, final String logicFlavour, final String logic) {
80 super(key, logicFlavour, logic);
84 * This Constructor creates a logic instance by cloning the fields from another logic instance
85 * into this logic instance.
87 * @param logic the logic instance to clone from
89 public AxTaskSelectionLogic(final AxLogic logic) {
90 super(new AxReferenceKey(logic.getKey()), logic.getLogicFlavour(), logic.getLogic());
94 * This Constructor creates a logic instance with a reference key constructed from the parents
95 * key and the logic local name, the given logic flavour, with the logic being provided by the
96 * given logic reader instance.
98 * @param parentKey the reference key of the parent of this logic
99 * @param logicName the logic name, held as the local name of the reference key of this logic
100 * @param logicFlavour the flavour of this logic
101 * @param logicReader the logic reader to use to read the logic for this logic instance
103 public AxTaskSelectionLogic(final AxReferenceKey parentKey, final String logicName, final String logicFlavour,
104 final AxLogicReader logicReader) {
105 super(new AxReferenceKey(parentKey, logicName), logicFlavour, logicReader);
109 * This Constructor creates a logic instance with the given reference key and logic flavour, the
110 * logic is provided by the given logic reader instance.
112 * @param key the reference key of this logic
113 * @param logicFlavour the flavour of this logic
114 * @param logicReader the logic reader to use to read the logic for this logic instance
116 public AxTaskSelectionLogic(final AxReferenceKey key, final String logicFlavour, final AxLogicReader logicReader) {
117 super(key, logicFlavour, logicReader);