Set all cross references of policy/models
[policy/models.git] / models-pdp / src / main / java / org / onap / policy / models / pdp / concepts / PdpStatistics.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019-2021 Nordix Foundation.
4  *  Modifications Copyright (C) 2019 AT&T Intellectual Property.
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.models.pdp.concepts;
23
24
25 import java.time.Instant;
26 import java.util.List;
27 import lombok.Data;
28 import lombok.NoArgsConstructor;
29 import lombok.NonNull;
30 import org.onap.policy.models.base.PfUtils;
31
32 /**
33  * Class to represent statistics of a running PDP.
34  *
35  * @author Ram Krishna Verma (ram.krishna.verma@est.tech)
36  */
37 @Data
38 @NoArgsConstructor
39 public class PdpStatistics {
40
41     private String pdpInstanceId;
42     private Instant timeStamp;
43     private Long generatedId;
44     private String pdpGroupName;
45     private String pdpSubGroupName;
46     private long policyExecutedCount;
47     private long policyExecutedSuccessCount;
48     private long policyExecutedFailCount;
49     private long policyDeployCount;
50     private long policyDeploySuccessCount;
51     private long policyDeployFailCount;
52     private long policyUndeployCount;
53     private long policyUndeploySuccessCount;
54     private long policyUndeployFailCount;
55     private List<PdpEngineWorkerStatistics> engineStats;
56
57     /**
58      * Constructs the object, making a deep copy.
59      *
60      * @param source source from which to copy
61      */
62     public PdpStatistics(@NonNull PdpStatistics source) {
63         this.pdpInstanceId = source.pdpInstanceId;
64         this.timeStamp = source.timeStamp;
65         this.generatedId = source.generatedId;
66         this.pdpGroupName = source.pdpGroupName;
67         this.pdpSubGroupName = source.pdpSubGroupName;
68         this.policyExecutedCount = source.policyExecutedCount;
69         this.policyExecutedFailCount = source.policyExecutedFailCount;
70         this.policyExecutedSuccessCount = source.policyExecutedSuccessCount;
71         this.policyDeployCount = source.policyDeployCount;
72         this.policyDeployFailCount = source.policyDeployFailCount;
73         this.policyDeploySuccessCount = source.policyDeploySuccessCount;
74         this.policyUndeployCount = source.policyUndeployCount;
75         this.policyUndeployFailCount = source.policyUndeployFailCount;
76         this.policyUndeploySuccessCount = source.policyUndeploySuccessCount;
77         this.engineStats = PfUtils.mapList(source.engineStats, PdpEngineWorkerStatistics::new, null);
78     }
79 }