2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.apex.model.policymodel.concepts;
23 import javax.persistence.Entity;
24 import javax.persistence.Inheritance;
25 import javax.persistence.InheritanceType;
26 import javax.persistence.Table;
27 import javax.xml.bind.annotation.XmlAccessType;
28 import javax.xml.bind.annotation.XmlAccessorType;
29 import javax.xml.bind.annotation.XmlRootElement;
30 import javax.xml.bind.annotation.XmlType;
32 import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
35 * This class holds Task Selection Logic for {@link AxState} states in Apex. It is a specialization
36 * of the {@link AxLogic} class, so that Task Selection Logic in Apex states can be strongly typed.
38 * <p>Task Selection Logic is used to select the task {@link AxTask} that a state will execute. The
39 * logic uses fields on the incoming trigger event and information from the context albums available
40 * on a state to decide what task {@link AxTask} to select for execution in a given context.
42 * <p>Validation uses standard Apex Logic validation, see validation in {@link AxLogic}.
45 @Table(name = "AxTaskSelectionLogic")
46 @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
48 @XmlAccessorType(XmlAccessType.FIELD)
49 @XmlRootElement(name = "apexTaskSelectionLogic", namespace = "http://www.onap.org/policy/apex-pdp")
50 @XmlType(name = "AxTaskSelectionLogic", namespace = "http://www.onap.org/policy/apex-pdp")
52 public class AxTaskSelectionLogic extends AxLogic {
53 private static final long serialVersionUID = 2090324845463750391L;
56 * The Default Constructor creates a logic instance with a null key, undefined logic flavour and
57 * a null logic string.
59 public AxTaskSelectionLogic() {
64 * The Key Constructor creates a logic instance with the given reference key, undefined logic
65 * flavour and a null logic string.
67 * @param key the reference key of the logic
69 public AxTaskSelectionLogic(final AxReferenceKey key) {
70 super(key, LOGIC_FLAVOUR_UNDEFINED, "");
74 * This Constructor creates a logic instance with a reference key constructed from the parents
75 * key and the logic local name and all of its fields defined.
77 * @param parentKey the reference key of the parent of this logic
78 * @param logicName the logic name, held as the local name of the reference key of this logic
79 * @param logicFlavour the flavour of this logic
80 * @param logic the actual logic as a string
82 public AxTaskSelectionLogic(final AxReferenceKey parentKey, final String logicName, final String logicFlavour,
84 super(parentKey, logicName, logicFlavour, logic);
88 * This Constructor creates a logic instance with the given reference key and all of its fields
91 * @param key the reference key of this logic
92 * @param logicFlavour the flavour of this logic
93 * @param logic the actual logic as a string
95 public AxTaskSelectionLogic(final AxReferenceKey key, final String logicFlavour, final String logic) {
96 super(key, logicFlavour, logic);
100 * This Constructor creates a logic instance by cloning the fields from another logic instance
101 * into this logic instance.
103 * @param logic the logic instance to clone from
105 public AxTaskSelectionLogic(final AxLogic logic) {
106 super(new AxReferenceKey(logic.getKey()), logic.getLogicFlavour(), logic.getLogic());
110 * This Constructor creates a logic instance with a reference key constructed from the parents
111 * key and the logic local name, the given logic flavour, with the logic being provided by the
112 * given logic reader instance.
114 * @param parentKey the reference key of the parent of this logic
115 * @param logicName the logic name, held as the local name of the reference key of this logic
116 * @param logicFlavour the flavour of this logic
117 * @param logicReader the logic reader to use to read the logic for this logic instance
119 public AxTaskSelectionLogic(final AxReferenceKey parentKey, final String logicName, final String logicFlavour,
120 final AxLogicReader logicReader) {
121 super(new AxReferenceKey(parentKey, logicName), logicFlavour, logicReader);
125 * This Constructor creates a logic instance with the given reference key and logic flavour, the
126 * logic is provided by the given logic reader instance.
128 * @param key the reference key of this logic
129 * @param logicFlavour the flavour of this logic
130 * @param logicReader the logic reader to use to read the logic for this logic instance
132 public AxTaskSelectionLogic(final AxReferenceKey key, final String logicFlavour, final AxLogicReader logicReader) {
133 super(key, logicFlavour, logicReader);