Commit includes ControlLoopPolicy API and bugfixes
[policy/engine.git] / ECOMP-ControlloopPolicy / src / main / java / org / openecomp / policy / controlloop / policy / ControlLoopPolicy.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 import java.util.List;
24
25 public class ControlLoopPolicy {
26         
27         private ControlLoop controlLoop;
28
29         private List<Policy> policies;
30
31         public ControlLoop getControlLoop() {
32                 return controlLoop;
33         }
34
35         public void setControlLoop(ControlLoop controlLoop) {
36                 this.controlLoop = controlLoop;
37         }
38
39         public List<Policy> getPolicies() {
40                 return policies;
41         }
42
43         public void setPolicies(List<Policy> policies) {
44                 this.policies = policies;
45         }
46
47         @Override
48         public String toString() {
49                 return "ControlLoopPolicy [controlLoop=" + controlLoop + ", policies=" + policies + "]";
50         }
51
52         @Override
53         public int hashCode() {
54                 final int prime = 31;
55                 int result = 1;
56                 result = prime * result + ((controlLoop == null) ? 0 : controlLoop.hashCode());
57                 result = prime * result + ((policies == null) ? 0 : policies.hashCode());
58                 return result;
59         }
60
61         @Override
62         public boolean equals(Object obj) {
63                 if (this == obj)
64                         return true;
65                 if (obj == null)
66                         return false;
67                 if (getClass() != obj.getClass())
68                         return false;
69                 ControlLoopPolicy other = (ControlLoopPolicy) obj;
70                 if (controlLoop == null) {
71                         if (other.controlLoop != null)
72                                 return false;
73                 } else if (!controlLoop.equals(other.controlLoop))
74                         return false;
75                 if (policies == null) {
76                         if (other.policies != null)
77                                 return false;
78                 } else if (!policies.equals(other.policies))
79                         return false;
80                 return true;
81         }
82
83 }