3f5e4e8dfbb99d3fc49b68d11f5466aac074e911
[policy/apex-pdp.git] / model / policy-model / src / main / java / org / onap / policy / apex / model / policymodel / concepts / AxStateParamsBuilder.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2018 Samsung Electronics Co., Ltd. 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 java.util.Map;
24 import java.util.Set;
25
26 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
27 import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
28
29 public class AxStateParamsBuilder {
30     private AxReferenceKey key;
31     private AxArtifactKey trigger;
32     private Map<String, AxStateOutput> stateOutputs;
33     private Set<AxArtifactKey> contextAlbumReferenceSet;
34     private AxTaskSelectionLogic taskSelectionLogic;
35     private Map<String, AxStateFinalizerLogic> stateFinalizerLogicMap;
36     private AxArtifactKey defaultTask;
37     private Map<AxArtifactKey, AxStateTaskReference> taskReferenceMap;
38
39     public AxReferenceKey getKey() {
40         return key;
41     }
42
43     public AxArtifactKey getTrigger() {
44         return trigger;
45     }
46
47     public Map<String, AxStateOutput> getStateOutputs() {
48         return stateOutputs;
49     }
50
51     public Set<AxArtifactKey> getContextAlbumReferenceSet() {
52         return contextAlbumReferenceSet;
53     }
54
55     public AxTaskSelectionLogic getTaskSelectionLogic() {
56         return taskSelectionLogic;
57     }
58
59     public Map<String, AxStateFinalizerLogic> getStateFinalizerLogicMap() {
60         return stateFinalizerLogicMap;
61     }
62
63     public AxArtifactKey getDefaultTask() {
64         return defaultTask;
65     }
66
67     public Map<AxArtifactKey, AxStateTaskReference> getTaskReferenceMap() {
68         return taskReferenceMap;
69     }
70
71     /**
72      * Setter method.
73      *
74      * @param key the reference key of the state
75      * @return builder object
76      */
77     public AxStateParamsBuilder key(AxReferenceKey key) {
78         this.key = key;
79         return this;
80     }
81
82     /**
83      * Setter method.
84      *
85      * @param trigger the event that triggers the state
86      * @return builder object
87      */
88     public AxStateParamsBuilder trigger(AxArtifactKey trigger) {
89         this.trigger = trigger;
90         return this;
91     }
92
93     /**
94      * Setter method.
95      *
96      * @param stateOutputs the possible state outputs for the state
97      * @return builder object
98      */
99     public AxStateParamsBuilder stateOutputs(Map<String, AxStateOutput> stateOutputs) {
100         this.stateOutputs = stateOutputs;
101         return this;
102     }
103
104     /**
105      * Setter method.
106      *
107      * @param contextAlbumReferenceSet the context album reference set defines the context that may
108      *                                 be used by Task Selection Logic and State Finalizer Logic in the state
109      * @return builder object
110      */
111     public AxStateParamsBuilder contextAlbumReferenceSet(Set<AxArtifactKey> contextAlbumReferenceSet) {
112         this.contextAlbumReferenceSet = contextAlbumReferenceSet;
113         return this;
114     }
115
116     /**
117      * Setter method.
118      *
119      * @param taskSelectionLogic the task selection logic that selects the task a state executes in
120      *                           an execution cycle
121      * @return builder object
122      */
123     public AxStateParamsBuilder taskSelectionLogic(AxTaskSelectionLogic taskSelectionLogic) {
124         this.taskSelectionLogic = taskSelectionLogic;
125         return this;
126     }
127
128     /**
129      * Setter method.
130      *
131      * @param stateFinalizerLogicMap the state finalizer logic instances that selects the state
132      *                               output to use after a task executes in a state execution cycle
133      * @return builder object
134      */
135     public AxStateParamsBuilder stateFinalizerLogicMap(
136             Map<String, AxStateFinalizerLogic> stateFinalizerLogicMap) {
137         this.stateFinalizerLogicMap = stateFinalizerLogicMap;
138         return this;
139     }
140
141     /**
142      * Setter method.
143      *
144      * @param defaultTask the default task that will execute in a state if Task Selection Logic is
145      *                    not specified
146      * @return builder object
147      */
148     public AxStateParamsBuilder defaultTask(AxArtifactKey defaultTask) {
149         this.defaultTask = defaultTask;
150         return this;
151     }
152
153     /**
154      * Setter method.
155      *
156      * @param taskReferenceMap the task reference map that defines the tasks for the state and how
157      * @return builder object
158      */
159     public AxStateParamsBuilder taskReferenceMap(Map<AxArtifactKey, AxStateTaskReference> taskReferenceMap) {
160         this.taskReferenceMap = taskReferenceMap;
161         return this;
162     }
163 }