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;
26 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
27 import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
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;
39 public AxReferenceKey getKey() {
43 public AxArtifactKey getTrigger() {
47 public Map<String, AxStateOutput> getStateOutputs() {
51 public Set<AxArtifactKey> getContextAlbumReferenceSet() {
52 return contextAlbumReferenceSet;
55 public AxTaskSelectionLogic getTaskSelectionLogic() {
56 return taskSelectionLogic;
59 public Map<String, AxStateFinalizerLogic> getStateFinalizerLogicMap() {
60 return stateFinalizerLogicMap;
63 public AxArtifactKey getDefaultTask() {
67 public Map<AxArtifactKey, AxStateTaskReference> getTaskReferenceMap() {
68 return taskReferenceMap;
74 * @param key the reference key of the state
75 * @return builder object
77 public AxStateParamsBuilder key(AxReferenceKey key) {
85 * @param trigger the event that triggers the state
86 * @return builder object
88 public AxStateParamsBuilder trigger(AxArtifactKey trigger) {
89 this.trigger = trigger;
96 * @param stateOutputs the possible state outputs for the state
97 * @return builder object
99 public AxStateParamsBuilder stateOutputs(Map<String, AxStateOutput> stateOutputs) {
100 this.stateOutputs = stateOutputs;
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
111 public AxStateParamsBuilder contextAlbumReferenceSet(Set<AxArtifactKey> contextAlbumReferenceSet) {
112 this.contextAlbumReferenceSet = contextAlbumReferenceSet;
119 * @param taskSelectionLogic the task selection logic that selects the task a state executes in
121 * @return builder object
123 public AxStateParamsBuilder taskSelectionLogic(AxTaskSelectionLogic taskSelectionLogic) {
124 this.taskSelectionLogic = taskSelectionLogic;
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
135 public AxStateParamsBuilder stateFinalizerLogicMap(
136 Map<String, AxStateFinalizerLogic> stateFinalizerLogicMap) {
137 this.stateFinalizerLogicMap = stateFinalizerLogicMap;
144 * @param defaultTask the default task that will execute in a state if Task Selection Logic is
146 * @return builder object
148 public AxStateParamsBuilder defaultTask(AxArtifactKey defaultTask) {
149 this.defaultTask = defaultTask;
156 * @param taskReferenceMap the task reference map that defines the tasks for the state and how
157 * @return builder object
159 public AxStateParamsBuilder taskReferenceMap(Map<AxArtifactKey, AxStateTaskReference> taskReferenceMap) {
160 this.taskReferenceMap = taskReferenceMap;