TCA pom: enable unit test execution
[dcaegen2/analytics/tca.git] / dcae-analytics-model / src / main / java / org / openecomp / dcae / apod / analytics / model / domain / policy / tca / MetricsPerEventName.java
1 /*
2  * ===============================LICENSE_START======================================
3  *  dcae-analytics
4  * ================================================================================
5  *    Copyright © 2017 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.openecomp.dcae.apod.analytics.model.domain.policy.tca;
22
23 import lombok.Data;
24 import lombok.EqualsAndHashCode;
25
26 import java.util.ArrayList;
27 import java.util.List;
28
29 /**
30  * TCA Metrics that need to applied to each Event Name
31  *
32  * @author Rajiv Singla . Creation Date: 11/5/2016.
33  */
34 @Data
35 @EqualsAndHashCode(callSuper = true)
36 public class MetricsPerEventName extends BaseTCAPolicyModel{
37
38
39     private static final long serialVersionUID = 1L;
40
41     /**
42      * Event Name to which TCA Policy needs to applied.
43      *
44      * @param eventName New value for eventName to which TCA Policy needs to applied
45      * @return Event Name to which TCA Policy needs to applied
46      */
47     private String eventName;
48
49     /**
50      * Control Loop Schema Type
51      *
52      * @param controlLoopSchemaType New value for Control Loop Schema Type
53      * @return Control Loop Schema Type
54      */
55     private ControlLoopSchemaType controlLoopSchemaType;
56
57     /**
58      * Policy Scope
59      *
60      * @param policyScope New value for Policy Scope
61      * @return Policy Scope
62      */
63     private String policyScope;
64
65     /**
66      * Policy Name
67      *
68      * @param policyName New value for Policy Name
69      * @return Policy Name
70      */
71     private String policyName;
72
73     /**
74      * Policy Version
75      *
76      * @param policyVersion New value for Policy Version
77      * @return Policy Version
78      */
79     private String policyVersion;
80
81     /**
82      * Policy Thresholds
83      *
84      * @param thresholds New value for Policy Thresholds
85      * @return Policy Thresholds
86      */
87     private List<Threshold> thresholds;
88
89
90     /**
91      * Creates a deep copy of given {@link MetricsPerEventName}
92      *
93      * @param metricsPerEventName metrics Per Event Name that need to copied
94      *
95      * @return copy of new metrics per event Name with values copied from given metrics per Event Name
96      */
97     public static MetricsPerEventName copy(final MetricsPerEventName metricsPerEventName) {
98         final MetricsPerEventName newMetricsPerEventName = new MetricsPerEventName();
99         newMetricsPerEventName.setEventName(metricsPerEventName.getEventName());
100         newMetricsPerEventName.setControlLoopSchemaType(metricsPerEventName.getControlLoopSchemaType());
101         newMetricsPerEventName.setPolicyScope(metricsPerEventName.getPolicyScope());
102         newMetricsPerEventName.setPolicyName(metricsPerEventName.getPolicyName());
103         newMetricsPerEventName.setPolicyVersion(metricsPerEventName.getPolicyVersion());
104         if (metricsPerEventName.getThresholds() != null) {
105             List<Threshold> newThresholds = new ArrayList<>(metricsPerEventName.getThresholds().size());
106             for( Threshold threshold : metricsPerEventName.getThresholds()) {
107                 newThresholds.add(Threshold.copy(threshold));
108             }
109             newMetricsPerEventName.setThresholds(newThresholds);
110         }
111         return newMetricsPerEventName;
112     }
113
114
115 }