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
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;
25 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
26 import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
28 public class AxStateParamsBuilder {
29 private AxReferenceKey key;
30 private AxArtifactKey trigger;
31 private Map<String, AxStateOutput> stateOutputs;
32 private Set<AxArtifactKey> contextAlbumReferenceSet;
33 private AxTaskSelectionLogic taskSelectionLogic;
34 private Map<String, AxStateFinalizerLogic> stateFinalizerLogicMap;
35 private AxArtifactKey defaultTask;
36 private Map<AxArtifactKey, AxStateTaskReference> taskReferenceMap;
38 public AxReferenceKey getKey() {
42 public AxArtifactKey getTrigger() {
46 public Map<String, AxStateOutput> getStateOutputs() {
50 public Set<AxArtifactKey> getContextAlbumReferenceSet() {
51 return contextAlbumReferenceSet;
54 public AxTaskSelectionLogic getTaskSelectionLogic() {
55 return taskSelectionLogic;
58 public Map<String, AxStateFinalizerLogic> getStateFinalizerLogicMap() {
59 return stateFinalizerLogicMap;
62 public AxArtifactKey getDefaultTask() {
66 public Map<AxArtifactKey, AxStateTaskReference> getTaskReferenceMap() {
67 return taskReferenceMap;
73 * @param key the reference key of the state
74 * @return builder object
76 public AxStateParamsBuilder key(AxReferenceKey key) {
84 * @param trigger the event that triggers the state
85 * @return builder object
87 public AxStateParamsBuilder trigger(AxArtifactKey trigger) {
88 this.trigger = trigger;
95 * @param stateOutputs the possible state outputs for the state
96 * @return builder object
98 public AxStateParamsBuilder stateOutputs(Map<String, AxStateOutput> stateOutputs) {
99 this.stateOutputs = stateOutputs;
106 * @param contextAlbumReferenceSet the context album reference set defines the context that may
107 * be used by Task Selection Logic and State Finalizer Logic in the state
108 * @return builder object
110 public AxStateParamsBuilder contextAlbumReferenceSet(Set<AxArtifactKey> contextAlbumReferenceSet) {
111 this.contextAlbumReferenceSet = contextAlbumReferenceSet;
118 * @param taskSelectionLogic the task selection logic that selects the task a state executes in
120 * @return builder object
122 public AxStateParamsBuilder taskSelectionLogic(AxTaskSelectionLogic taskSelectionLogic) {
123 this.taskSelectionLogic = taskSelectionLogic;
130 * @param stateFinalizerLogicMap the state finalizer logic instances that selects the state
131 * output to use after a task executes in a state execution cycle
132 * @return builder object
134 public AxStateParamsBuilder stateFinalizerLogicMap(
135 Map<String, AxStateFinalizerLogic> stateFinalizerLogicMap) {
136 this.stateFinalizerLogicMap = stateFinalizerLogicMap;
143 * @param defaultTask the default task that will execute in a state if Task Selection Logic is
145 * @return builder object
147 public AxStateParamsBuilder defaultTask(AxArtifactKey defaultTask) {
148 this.defaultTask = defaultTask;
155 * @param taskReferenceMap the task reference map that defines the tasks for the state and how
156 * @return builder object
158 public AxStateParamsBuilder taskReferenceMap(Map<AxArtifactKey, AxStateTaskReference> taskReferenceMap) {
159 this.taskReferenceMap = taskReferenceMap;