fa144156ed1a98ed9e7d9100a6542443dcaeec2c
[policy/engine.git] / ECOMP-ControlloopPolicy / src / main / java / org / openecomp / policy / controlloop / policy / ControlLoop.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ECOMP Policy Engine
4  * ================================================================================
5  * Copyright (C) 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.policy.controlloop.policy;
22
23 public class ControlLoop {
24         
25         public static String VERSION = "2.0.0";
26
27         public String controlLoopName;
28         public final String version = VERSION;
29         public String trigger_policy = FinalResult.FINAL_OPENLOOP.toString();
30         public Integer timeout;
31         public Boolean abatement = false;
32         
33         public ControlLoop() {
34                 
35         }
36         
37         public ControlLoop(ControlLoop controlLoop) {
38                 this.controlLoopName = controlLoop.controlLoopName;
39                 this.trigger_policy = controlLoop.trigger_policy;
40                 this.timeout = controlLoop.timeout;
41                 this.abatement = controlLoop.abatement;
42         }
43         @Override
44         public String toString() {
45                 return "ControlLoop [controlLoopName=" + controlLoopName + ", version=" + version
46                                 + ", trigger_policy=" + trigger_policy + ", timeout="
47                                 + timeout + ", abatement=" + abatement + "]";
48         }
49         @Override
50         public int hashCode() {
51                 final int prime = 31;
52                 int result = 1;
53                 result = prime * result + ((controlLoopName == null) ? 0 : controlLoopName.hashCode());
54                 result = prime * result + ((timeout == null) ? 0 : timeout.hashCode());
55                 result = prime * result + ((trigger_policy == null) ? 0 : trigger_policy.hashCode());
56                 result = prime * result + ((version == null) ? 0 : version.hashCode());
57                 result = prime * result + ((abatement == null) ? 0 : abatement.hashCode());
58                 return result;
59         }
60         @Override
61         public boolean equals(Object obj) {
62                 if (this == obj)
63                         return true;
64                 if (obj == null)
65                         return false;
66                 if (getClass() != obj.getClass())
67                         return false;
68                 ControlLoop other = (ControlLoop) obj;
69                 if (controlLoopName == null) {
70                         if (other.controlLoopName != null)
71                                 return false;
72                 } else if (!controlLoopName.equals(other.controlLoopName))
73                         return false;
74                 if (timeout == null) {
75                         if (other.timeout != null)
76                                 return false;
77                 } else if (!timeout.equals(other.timeout))
78                         return false;
79                 if (trigger_policy == null) {
80                         if (other.trigger_policy != null)
81                                 return false;
82                 } else if (!trigger_policy.equals(other.trigger_policy))
83                         return false;
84                 if (version == null) {
85                         if (other.version != null)
86                                 return false;
87                 } else if (!version.equals(other.version))
88                         return false;
89                 if (abatement == null) {
90                         if (other.abatement != null)
91                                 return false;
92                 } else if (!abatement.equals(other.abatement))
93                         return false;
94                 return true;
95         }
96         
97 }