2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.models.pdp.concepts;
24 import java.util.Date;
25 import java.util.List;
27 import lombok.NoArgsConstructor;
29 import lombok.ToString;
30 import org.onap.policy.models.base.PfUtils;
33 * Class to represent statistics of a running PDP.
35 * @author Ram Krishna Verma (ram.krishna.verma@est.tech)
41 public class PdpStatistics {
43 private String pdpInstanceId;
44 private Date timeStamp;
45 private String pdpGroupName;
46 private String pdpSubGroupName;
47 private long policyDeployCount;
48 private long policyDeploySuccessCount;
49 private long policyDeployFailCount;
50 private long policyExecutedCount;
51 private long policyExecutedSuccessCount;
52 private long policyExecutedFailCount;
53 private List<PdpEngineWorkerStatistics> engineStats;
56 * Constructs the object, making a deep copy.
58 * @param source source from which to copy
60 public PdpStatistics(PdpStatistics source) {
61 this.pdpInstanceId = source.pdpInstanceId;
62 this.timeStamp = source.timeStamp == null ? null : new Date(source.timeStamp.getTime());
63 this.pdpGroupName = source.pdpGroupName;
64 this.pdpSubGroupName = source.pdpSubGroupName;
65 this.policyDeployCount = source.policyDeployCount;
66 this.policyDeployFailCount = source.policyDeployFailCount;
67 this.policyDeploySuccessCount = source.policyDeploySuccessCount;
68 this.policyExecutedCount = source.policyExecutedCount;
69 this.policyExecutedFailCount = source.policyExecutedFailCount;
70 this.policyExecutedSuccessCount = source.policyExecutedSuccessCount;
71 this.engineStats = PfUtils.mapList(source.engineStats, PdpEngineWorkerStatistics::new, null);