Changes for checkstyle 8.32
[policy/apex-pdp.git] / core / core-engine / src / main / java / org / onap / policy / apex / core / engine / TaskParameters.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2020 Nordix Foundation.
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
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.apex.core.engine;
22
23 import lombok.Getter;
24 import lombok.Setter;
25 import org.onap.policy.common.parameters.BeanValidator;
26 import org.onap.policy.common.parameters.ValidationResult;
27 import org.onap.policy.common.parameters.annotations.NotBlank;
28 import org.onap.policy.common.parameters.annotations.NotNull;
29
30 /**
31  * This class provides the configurable parameters for Apex Tasks.
32  *
33  * @author Ajith Sreekumar (ajith.sreekumar@est.tech)
34  */
35 @Getter
36 @Setter
37 public class TaskParameters {
38     private String name;
39
40     // If taskId is not specified, then the taskParameter is added to all tasks in the engine.
41     private String taskId;
42
43     @NotNull
44     @NotBlank
45     private String key;
46     @NotNull
47     @NotBlank
48     private String value;
49
50     public TaskParameters() {
51         this.name = "taskParameters";
52     }
53
54     /**
55      * Full constructor.
56      *
57      * @param key the task parameter key
58      * @param value the task parameter value
59      * @param taskId the task ID of this task parameter
60      */
61     public TaskParameters(String key, String value, String taskId) {
62         this();
63         this.key = key;
64         this.value = value;
65         this.taskId = taskId;
66     }
67
68     /**
69      * Validates the parameters.
70      *
71      * @param resultName name of the result
72      *
73      * @return the validation result
74      */
75     public ValidationResult validate(String resultName) {
76         return new BeanValidator().validateTop(resultName, this);
77     }
78 }