c9b96e36602bbcebcbfa7dd9593fab2193906b27
[policy/api.git] / main / src / main / java / org / onap / policy / api / main / parameters / ApiParameterGroup.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
4  *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
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.api.main.parameters;
23
24 import java.util.List;
25 import lombok.Getter;
26 import org.onap.policy.common.endpoints.parameters.RestServerParameters;
27 import org.onap.policy.common.parameters.ParameterGroupImpl;
28 import org.onap.policy.common.parameters.annotations.NotBlank;
29 import org.onap.policy.common.parameters.annotations.NotNull;
30 import org.onap.policy.common.parameters.annotations.Valid;
31 import org.onap.policy.models.provider.PolicyModelsProviderParameters;
32
33 /**
34  * Class to hold all parameters needed for Api component.
35  *
36  */
37 @Getter
38 public class ApiParameterGroup extends ParameterGroupImpl {
39
40     @NotNull @Valid
41     private final RestServerParameters restServerParameters;
42     @NotNull @Valid
43     private final PolicyModelsProviderParameters databaseProviderParameters;
44     private final List<@NotNull @NotBlank String> preloadPolicyTypes;
45     private final List<@NotNull @NotBlank String> preloadPolicies;
46
47     /**
48      * Create the api parameter group.
49      *
50      * @param name the parameter group name
51      * @param restServerParameters the parameters for instantiating API rest server
52      * @param databaseProviderParameters the parameters for instantiating database provider
53      * @param preloadPolicyTypes the list of preloaded policy types
54      * @param preloadPolicies the list of preloaded policies
55      */
56     public ApiParameterGroup(final String name, final RestServerParameters restServerParameters,
57             final PolicyModelsProviderParameters databaseProviderParameters, final List<String> preloadPolicyTypes,
58             final List<String> preloadPolicies) {
59         super(name);
60         this.restServerParameters = restServerParameters;
61         this.databaseProviderParameters = databaseProviderParameters;
62         this.preloadPolicyTypes = preloadPolicyTypes;
63         this.preloadPolicies = preloadPolicies;
64     }
65 }