Remove GroupValidationResult
[policy/models.git] / models-provider / src / main / java / org / onap / policy / models / provider / PolicyModelsProviderParameters.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019 Nordix Foundation.
4  *  Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
5  *  Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * SPDX-License-Identifier: Apache-2.0
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.policy.models.provider;
24
25 import lombok.Data;
26 import org.onap.policy.common.parameters.BeanValidationResult;
27 import org.onap.policy.common.parameters.BeanValidator;
28 import org.onap.policy.common.parameters.ParameterGroup;
29 import org.onap.policy.common.parameters.annotations.NotBlank;
30 import org.onap.policy.common.parameters.annotations.NotNull;
31 import org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl;
32
33 // @formatter:off
34 /**
35  * Class to hold all the plugin handler parameters.
36  *
37  * <p>The following parameters are defined:
38  * <ol>
39  * <li>name: A name for the parameters.
40  * <li>implementation: The implementation of the PolicyModelsProvider to use for writing and reading concepts,
41  * defaults to {@link DatabasePolicyModelsProviderImpl} and may not be null
42  * <li>databaseUrl: The JDBC URL for the database, mandatory.
43  * <li>databaseUser: The user id to use for connecting to the database, optional, defaults to null.
44  * <li>databasePassword: The password to use for connecting to the database, optional,
45  * defaults to null.
46  * <li>persistenceUnit: The persistence unit refined in META-INF/persistence.xml to use for connecting
47  * to the database, mandatory.
48  * </ol>
49  *
50  * @author Liam Fallon (liam.fallon@est.tech)
51  */
52 //@formatter:on
53
54 @Data
55 public class PolicyModelsProviderParameters implements ParameterGroup {
56     private static final String DEFAULT_IMPLEMENTATION = DatabasePolicyModelsProviderImpl.class.getName();
57
58     private String name;
59     @NotNull @NotBlank
60     private String implementation = DEFAULT_IMPLEMENTATION;
61     private String databaseType;
62     @NotNull @NotBlank
63     private String databaseDriver;
64     @NotNull @NotBlank
65     private String databaseUrl;
66     private String databaseUser;
67     private String databasePassword;
68     @NotNull @NotBlank
69     private String persistenceUnit;
70
71     /**
72      * Validate the model provider parameters.
73      *
74      */
75
76     @Override
77     public BeanValidationResult validate() {
78         return new BeanValidator().validateTop(getClass().getSimpleName(), this);
79     }
80 }