b9cfd802dbb0cd7073d63360d7f7a8d3fcd336fa
[policy/apex-pdp.git] /
1 /*-
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
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  * SPDX-License-Identifier: Apache-2.0
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.apex.model.policymodel.concepts;
23
24 import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
25
26 /**
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.
29  *
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.
33  *
34  * <p>Validation uses standard Apex Logic validation, see validation in {@link AxLogic}.
35  */
36 public class AxTaskSelectionLogic extends AxLogic {
37     private static final long serialVersionUID = 2090324845463750391L;
38
39     /**
40      * The Default Constructor creates a logic instance with a null key, undefined logic flavour and
41      * a null logic string.
42      */
43     public AxTaskSelectionLogic() {
44         super();
45     }
46
47     /**
48      * The Key Constructor creates a logic instance with the given reference key, undefined logic
49      * flavour and a null logic string.
50      *
51      * @param key the reference key of the logic
52      */
53     public AxTaskSelectionLogic(final AxReferenceKey key) {
54         super(key, LOGIC_FLAVOUR_UNDEFINED, "");
55     }
56
57     /**
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.
60      *
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
65      */
66     public AxTaskSelectionLogic(final AxReferenceKey parentKey, final String logicName, final String logicFlavour,
67             final String logic) {
68         super(parentKey, logicName, logicFlavour, logic);
69     }
70
71     /**
72      * This Constructor creates a logic instance with the given reference key and all of its fields
73      * defined.
74      *
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
78      */
79     public AxTaskSelectionLogic(final AxReferenceKey key, final String logicFlavour, final String logic) {
80         super(key, logicFlavour, logic);
81     }
82
83     /**
84      * This Constructor creates a logic instance by cloning the fields from another logic instance
85      * into this logic instance.
86      *
87      * @param logic the logic instance to clone from
88      */
89     public AxTaskSelectionLogic(final AxLogic logic) {
90         super(new AxReferenceKey(logic.getKey()), logic.getLogicFlavour(), logic.getLogic());
91     }
92
93     /**
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.
97      *
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
102      */
103     public AxTaskSelectionLogic(final AxReferenceKey parentKey, final String logicName, final String logicFlavour,
104             final AxLogicReader logicReader) {
105         super(new AxReferenceKey(parentKey, logicName), logicFlavour, logicReader);
106     }
107
108     /**
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.
111      *
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
115      */
116     public AxTaskSelectionLogic(final AxReferenceKey key, final String logicFlavour, final AxLogicReader logicReader) {
117         super(key, logicFlavour, logicReader);
118     }
119 }