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 javax.xml.bind.annotation.XmlAccessType;
25 import javax.xml.bind.annotation.XmlAccessorType;
26 import javax.xml.bind.annotation.XmlRootElement;
27 import javax.xml.bind.annotation.XmlType;
28 import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
31 * This class holds Task Selection Logic for {@link AxState} states in Apex. It is a specialization
32 * of the {@link AxLogic} class, so that Task Selection Logic in Apex states can be strongly typed.
34 * <p>Task Selection Logic is used to select the task {@link AxTask} that a state will execute. The
35 * logic uses fields on the incoming trigger event and information from the context albums available
36 * on a state to decide what task {@link AxTask} to select for execution in a given context.
38 * <p>Validation uses standard Apex Logic validation, see validation in {@link AxLogic}.
40 @XmlAccessorType(XmlAccessType.FIELD)
41 @XmlRootElement(name = "apexTaskSelectionLogic", namespace = "http://www.onap.org/policy/apex-pdp")
42 @XmlType(name = "AxTaskSelectionLogic", namespace = "http://www.onap.org/policy/apex-pdp")
44 public class AxTaskSelectionLogic extends AxLogic {
45 private static final long serialVersionUID = 2090324845463750391L;
48 * The Default Constructor creates a logic instance with a null key, undefined logic flavour and
49 * a null logic string.
51 public AxTaskSelectionLogic() {
56 * The Key Constructor creates a logic instance with the given reference key, undefined logic
57 * flavour and a null logic string.
59 * @param key the reference key of the logic
61 public AxTaskSelectionLogic(final AxReferenceKey key) {
62 super(key, LOGIC_FLAVOUR_UNDEFINED, "");
66 * This Constructor creates a logic instance with a reference key constructed from the parents
67 * key and the logic local name and all of its fields defined.
69 * @param parentKey the reference key of the parent of this logic
70 * @param logicName the logic name, held as the local name of the reference key of this logic
71 * @param logicFlavour the flavour of this logic
72 * @param logic the actual logic as a string
74 public AxTaskSelectionLogic(final AxReferenceKey parentKey, final String logicName, final String logicFlavour,
76 super(parentKey, logicName, logicFlavour, logic);
80 * This Constructor creates a logic instance with the given reference key and all of its fields
83 * @param key the reference key of this logic
84 * @param logicFlavour the flavour of this logic
85 * @param logic the actual logic as a string
87 public AxTaskSelectionLogic(final AxReferenceKey key, final String logicFlavour, final String logic) {
88 super(key, logicFlavour, logic);
92 * This Constructor creates a logic instance by cloning the fields from another logic instance
93 * into this logic instance.
95 * @param logic the logic instance to clone from
97 public AxTaskSelectionLogic(final AxLogic logic) {
98 super(new AxReferenceKey(logic.getKey()), logic.getLogicFlavour(), logic.getLogic());
102 * This Constructor creates a logic instance with a reference key constructed from the parents
103 * key and the logic local name, the given logic flavour, with the logic being provided by the
104 * given logic reader instance.
106 * @param parentKey the reference key of the parent of this logic
107 * @param logicName the logic name, held as the local name of the reference key of this logic
108 * @param logicFlavour the flavour of this logic
109 * @param logicReader the logic reader to use to read the logic for this logic instance
111 public AxTaskSelectionLogic(final AxReferenceKey parentKey, final String logicName, final String logicFlavour,
112 final AxLogicReader logicReader) {
113 super(new AxReferenceKey(parentKey, logicName), logicFlavour, logicReader);
117 * This Constructor creates a logic instance with the given reference key and logic flavour, the
118 * logic is provided by the given logic reader instance.
120 * @param key the reference key of this logic
121 * @param logicFlavour the flavour of this logic
122 * @param logicReader the logic reader to use to read the logic for this logic instance
124 public AxTaskSelectionLogic(final AxReferenceKey key, final String logicFlavour, final AxLogicReader logicReader) {
125 super(key, logicFlavour, logicReader);