Changes for checkstyle 8.32
[policy/apex-pdp.git] / model / policy-model / src / main / java / org / onap / policy / apex / model / policymodel / concepts / AxTaskSelectionLogic.java
1 /*-
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
8  * 
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  * 
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.
16  * 
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.apex.model.policymodel.concepts;
22
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;
31 import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
32
33 /**
34  * This class holds Task Selection Logic for {@link AxState} states in Apex. It is a specialization
35  * of the {@link AxLogic} class, so that Task Selection Logic in Apex states can be strongly typed.
36  * 
37  * <p>Task Selection Logic is used to select the task {@link AxTask} that a state will execute. The
38  * logic uses fields on the incoming trigger event and information from the context albums available
39  * on a state to decide what task {@link AxTask} to select for execution in a given context.
40  * 
41  * <p>Validation uses standard Apex Logic validation, see validation in {@link AxLogic}.
42  */
43 @Entity
44 @Table(name = "AxTaskSelectionLogic")
45 @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
46
47 @XmlAccessorType(XmlAccessType.FIELD)
48 @XmlRootElement(name = "apexTaskSelectionLogic", namespace = "http://www.onap.org/policy/apex-pdp")
49 @XmlType(name = "AxTaskSelectionLogic", namespace = "http://www.onap.org/policy/apex-pdp")
50
51 public class AxTaskSelectionLogic extends AxLogic {
52     private static final long serialVersionUID = 2090324845463750391L;
53
54     /**
55      * The Default Constructor creates a logic instance with a null key, undefined logic flavour and
56      * a null logic string.
57      */
58     public AxTaskSelectionLogic() {
59         super();
60     }
61
62     /**
63      * The Key Constructor creates a logic instance with the given reference key, undefined logic
64      * flavour and a null logic string.
65      *
66      * @param key the reference key of the logic
67      */
68     public AxTaskSelectionLogic(final AxReferenceKey key) {
69         super(key, LOGIC_FLAVOUR_UNDEFINED, "");
70     }
71
72     /**
73      * This Constructor creates a logic instance with a reference key constructed from the parents
74      * key and the logic local name and all of its fields defined.
75      *
76      * @param parentKey the reference key of the parent of this logic
77      * @param logicName the logic name, held as the local name of the reference key of this logic
78      * @param logicFlavour the flavour of this logic
79      * @param logic the actual logic as a string
80      */
81     public AxTaskSelectionLogic(final AxReferenceKey parentKey, final String logicName, final String logicFlavour,
82             final String logic) {
83         super(parentKey, logicName, logicFlavour, logic);
84     }
85
86     /**
87      * This Constructor creates a logic instance with the given reference key and all of its fields
88      * defined.
89      *
90      * @param key the reference key of this logic
91      * @param logicFlavour the flavour of this logic
92      * @param logic the actual logic as a string
93      */
94     public AxTaskSelectionLogic(final AxReferenceKey key, final String logicFlavour, final String logic) {
95         super(key, logicFlavour, logic);
96     }
97
98     /**
99      * This Constructor creates a logic instance by cloning the fields from another logic instance
100      * into this logic instance.
101      *
102      * @param logic the logic instance to clone from
103      */
104     public AxTaskSelectionLogic(final AxLogic logic) {
105         super(new AxReferenceKey(logic.getKey()), logic.getLogicFlavour(), logic.getLogic());
106     }
107
108     /**
109      * This Constructor creates a logic instance with a reference key constructed from the parents
110      * key and the logic local name, the given logic flavour, with the logic being provided by the
111      * given logic reader instance.
112      *
113      * @param parentKey the reference key of the parent of this logic
114      * @param logicName the logic name, held as the local name of the reference key of this logic
115      * @param logicFlavour the flavour of this logic
116      * @param logicReader the logic reader to use to read the logic for this logic instance
117      */
118     public AxTaskSelectionLogic(final AxReferenceKey parentKey, final String logicName, final String logicFlavour,
119             final AxLogicReader logicReader) {
120         super(new AxReferenceKey(parentKey, logicName), logicFlavour, logicReader);
121     }
122
123     /**
124      * This Constructor creates a logic instance with the given reference key and logic flavour, the
125      * logic is provided by the given logic reader instance.
126      *
127      * @param key the reference key of this logic
128      * @param logicFlavour the flavour of this logic
129      * @param logicReader the logic reader to use to read the logic for this logic instance
130      */
131     public AxTaskSelectionLogic(final AxReferenceKey key, final String logicFlavour, final AxLogicReader logicReader) {
132         super(key, logicFlavour, logicReader);
133     }
134 }