901c496824a1d9943ba23aaa5fc6f6b1254ce282
[policy/distribution.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2018 Ericsson. All rights reserved.
4  *  Copyright (C) 2019 Nordix Foundation.
5  *  Modifications Copyright (C) 2021 AT&T Intellectual Property. 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.distribution.reception.parameters;
24
25 import lombok.Getter;
26 import lombok.Setter;
27 import org.onap.policy.common.parameters.BeanValidationResult;
28 import org.onap.policy.common.parameters.BeanValidator;
29 import org.onap.policy.common.parameters.ParameterGroup;
30 import org.onap.policy.common.parameters.annotations.ClassName;
31 import org.onap.policy.common.parameters.annotations.NotBlank;
32 import org.onap.policy.common.parameters.annotations.NotNull;
33 import org.onap.policy.common.parameters.annotations.Valid;
34
35 /**
36  * Class to hold all the reception handler parameters.
37  *
38  * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
39  */
40 @NotNull
41 @NotBlank
42 @Getter
43 public class ReceptionHandlerParameters implements ParameterGroup {
44     private @Setter String name;
45     private String receptionHandlerType;
46     private @ClassName String receptionHandlerClassName;
47     private String receptionHandlerConfigurationName;
48     private @Valid PluginHandlerParameters pluginHandlerParameters;
49
50     /**
51      * Constructor for instantiating ReceptionHandlerParameters.
52      *
53      * @param receptionHandlerType the reception handler type
54      * @param receptionHandlerClassName the reception handler class name
55      * @param receptionHandlerConfigurationName the name of the configuration for the reception handler
56      * @param pluginHandlerParameters the plugin handler parameters
57      */
58     public ReceptionHandlerParameters(final String receptionHandlerType, final String receptionHandlerClassName,
59             final String receptionHandlerConfigurationName, final PluginHandlerParameters pluginHandlerParameters) {
60         this.receptionHandlerType = receptionHandlerType;
61         this.receptionHandlerClassName = receptionHandlerClassName;
62         this.receptionHandlerConfigurationName = receptionHandlerConfigurationName;
63         this.pluginHandlerParameters = pluginHandlerParameters;
64     }
65
66     @Override
67     public String getName() {
68         return name + "_" + receptionHandlerType;
69     }
70
71     /**
72      * Validate the reception handler parameters.
73      *
74      */
75     @Override
76     public BeanValidationResult validate() {
77         return new BeanValidator().validateTop(getClass().getSimpleName(), this);
78     }
79 }