fc919d8457aa32edf17d4b6e36a2d1080bb581dd
[policy/drools-applications.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP
4  * ================================================================================
5  * Copyright (C) 2020 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  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.controlloop.ophistory;
22
23 import lombok.AllArgsConstructor;
24 import lombok.Builder;
25 import lombok.Data;
26 import lombok.NoArgsConstructor;
27 import org.onap.policy.common.parameters.BeanValidator;
28 import org.onap.policy.common.parameters.ValidationResult;
29 import org.onap.policy.common.parameters.annotations.Min;
30 import org.onap.policy.common.parameters.annotations.NotBlank;
31 import org.onap.policy.common.parameters.annotations.NotNull;
32
33 /**
34  * Parameters for a Data Manager.
35  */
36 @NotNull
37 @Data
38 @Builder
39 @NoArgsConstructor
40 @AllArgsConstructor
41 public class OperationHistoryDataManagerParams {
42     public static final String DEFAULT_PU = "OperationsHistoryPU";
43
44     @NotBlank
45     private String url;
46     @NotBlank
47     private String userName;
48
49     // may be blank
50     private String password;
51
52     @Builder.Default
53     private String persistenceUnit = DEFAULT_PU;
54
55     /**
56      * Maximum number of records that can be waiting to be inserted into the DB. When the
57      * limit is reached, the oldest records are discarded.
58      */
59     @Min(1)
60     @Builder.Default
61     private int maxQueueLength = 10000;
62
63     /**
64      * Number of records to add the DB in one transaction.
65      */
66     @Min(1)
67     @Builder.Default
68     private int batchSize = 100;
69
70     /**
71      * Validates the parameters.
72      *
73      * @param resultName name of the result
74      *
75      * @return the validation result
76      */
77     public ValidationResult validate(String resultName) {
78         return new BeanValidator().validateTop(resultName, this);
79     }
80 }