82024af69cc2b18bfc75fbbdb3a2e6e0e221e37b
[dcaegen2/analytics/tca.git] / dcae-analytics-model / src / main / java / org / openecomp / dcae / apod / analytics / model / domain / policy / tca / MetricsPerEventName.java
1 /*\r
2  * ===============================LICENSE_START======================================\r
3  *  dcae-analytics\r
4  * ================================================================================\r
5  *    Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  *  Licensed under the Apache License, Version 2.0 (the "License");\r
8  *  you may not use this file except in compliance with the License.\r
9  *   You may obtain a copy of the License at\r
10  *\r
11  *          http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  *  Unless required by applicable law or agreed to in writing, software\r
14  *  distributed under the License is distributed on an "AS IS" BASIS,\r
15  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  *  See the License for the specific language governing permissions and\r
17  *  limitations under the License.\r
18  *  ============================LICENSE_END===========================================\r
19  */\r
20 \r
21 package org.openecomp.dcae.apod.analytics.model.domain.policy.tca;\r
22 \r
23 import lombok.Data;\r
24 import lombok.EqualsAndHashCode;\r
25 \r
26 import java.util.ArrayList;\r
27 import java.util.List;\r
28 \r
29 /**\r
30  * TCA Metrics that need to applied to each Event Name\r
31  *\r
32  * @author Rajiv Singla . Creation Date: 11/5/2016.\r
33  */\r
34 @Data\r
35 @EqualsAndHashCode(callSuper = true)\r
36 public class MetricsPerEventName extends BaseTCAPolicyModel{\r
37 \r
38 \r
39     private static final long serialVersionUID = 1L;\r
40 \r
41     /**\r
42      * Event Name to which TCA Policy needs to applied.\r
43      *\r
44      * @param eventName New value for eventName to which TCA Policy needs to applied\r
45      * @return Event Name to which TCA Policy needs to applied\r
46      */\r
47     private String eventName;\r
48 \r
49     /**\r
50      * Control Loop Schema Type\r
51      *\r
52      * @param controlLoopSchemaType New value for Control Loop Schema Type\r
53      * @return Control Loop Schema Type\r
54      */\r
55     private ControlLoopSchemaType controlLoopSchemaType;\r
56 \r
57     /**\r
58      * Policy Scope\r
59      *\r
60      * @param policyScope New value for Policy Scope\r
61      * @return Policy Scope\r
62      */\r
63     private String policyScope;\r
64 \r
65     /**\r
66      * Policy Name\r
67      *\r
68      * @param policyName New value for Policy Name\r
69      * @return Policy Name\r
70      */\r
71     private String policyName;\r
72 \r
73     /**\r
74      * Policy Version\r
75      *\r
76      * @param policyVersion New value for Policy Version\r
77      * @return Policy Version\r
78      */\r
79     private String policyVersion;\r
80 \r
81     /**\r
82      * Policy Thresholds\r
83      *\r
84      * @param thresholds New value for Policy Thresholds\r
85      * @return Policy Thresholds\r
86      */\r
87     private List<Threshold> thresholds;\r
88 \r
89 \r
90     /**\r
91      * Creates a deep copy of given {@link MetricsPerEventName}\r
92      *\r
93      * @param metricsPerEventName metrics Per Event Name that need to copied\r
94      *\r
95      * @return copy of new metrics per event Name with values copied from given metrics per Event Name\r
96      */\r
97     public static MetricsPerEventName copy(final MetricsPerEventName metricsPerEventName) {\r
98         final MetricsPerEventName newMetricsPerEventName = new MetricsPerEventName();\r
99         newMetricsPerEventName.setEventName(metricsPerEventName.getEventName());\r
100         newMetricsPerEventName.setControlLoopSchemaType(metricsPerEventName.getControlLoopSchemaType());\r
101         newMetricsPerEventName.setPolicyScope(metricsPerEventName.getPolicyScope());\r
102         newMetricsPerEventName.setPolicyName(metricsPerEventName.getPolicyName());\r
103         newMetricsPerEventName.setPolicyVersion(metricsPerEventName.getPolicyVersion());\r
104         if (metricsPerEventName.getThresholds() != null) {\r
105             List<Threshold> newThresholds = new ArrayList<>(metricsPerEventName.getThresholds().size());\r
106             for( Threshold threshold : metricsPerEventName.getThresholds()) {\r
107                 newThresholds.add(Threshold.copy(threshold));\r
108             }\r
109             newMetricsPerEventName.setThresholds(newThresholds);\r
110         }\r
111         return newMetricsPerEventName;\r
112     }\r
113 \r
114 \r
115 }\r