[POLICY-73] replace openecomp for policy-engine
[policy/engine.git] / ONAP-ControlloopPolicy / src / main / java / org / onap / policy / controlloop / policy / guard / MatchParameters.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP 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 package org.onap.policy.controlloop.policy.guard;
21
22 import java.util.LinkedList;
23 import java.util.List;
24
25 public class MatchParameters {
26         private String controlLoopName;
27         private String actor;
28         private String recipe;
29         private List<String> targets;
30
31         public MatchParameters() {
32                 // Do Nothing Empty Constructor.
33         }       
34         
35         public String getControlLoopName() {
36                 return controlLoopName;
37         }
38
39         public void setControlLoopName(String controlLoopName) {
40                 this.controlLoopName = controlLoopName;
41         }
42
43         public String getActor() {
44                 return actor;
45         }
46
47         public void setActor(String actor) {
48                 this.actor = actor;
49         }
50
51         public String getRecipe() {
52                 return recipe;
53         }
54
55         public void setRecipe(String recipe) {
56                 this.recipe = recipe;
57         }
58
59         public List<String> getTargets() {
60                 return targets;
61         }
62
63         public void setTargets(List<String> targets) {
64                 this.targets = targets;
65         }
66
67         public MatchParameters(String actor, String recipe) {
68                 this.actor = actor;
69                 this.recipe = recipe;
70         }
71
72         public MatchParameters(String actor, String recipe, List<String> targets) {
73                 this(actor, recipe);
74                 if (targets != null) {
75                         this.targets = new LinkedList<>(targets);
76                 }
77         }
78
79         public MatchParameters(String controlLoopName, String actor, String recipe, List<String> targets) {
80                 this(actor, recipe, targets);
81                 this.controlLoopName = controlLoopName;
82         }
83
84         public MatchParameters(MatchParameters matchParameters) {
85
86                 this.controlLoopName = matchParameters.controlLoopName;
87                 this.actor = matchParameters.actor;
88                 this.recipe = matchParameters.recipe;
89                 if (matchParameters.targets != null) {
90                         this.targets = new LinkedList<>(matchParameters.targets);
91                 }
92         }
93
94         @Override
95         public String toString() {
96                 return "MatchParameters [controlLoopName=" + controlLoopName + ", actor=" + actor + ", recipe=" + recipe
97                                 + ", targets=" + targets + "]";
98         }
99
100         @Override
101         public int hashCode() {
102                 final int prime = 31;
103                 int result = 1;
104                 result = prime * result + ((actor == null) ? 0 : actor.hashCode());
105                 result = prime * result + ((controlLoopName == null) ? 0 : controlLoopName.hashCode());
106                 result = prime * result + ((recipe == null) ? 0 : recipe.hashCode());
107                 result = prime * result + ((targets == null) ? 0 : targets.hashCode());
108                 return result;
109         }
110
111         @Override
112         public boolean equals(Object obj) {
113                 if (this == obj)
114                         return true;
115                 if (obj == null)
116                         return false;
117                 if (getClass() != obj.getClass())
118                         return false;
119                 MatchParameters other = (MatchParameters) obj;
120                 if (actor == null) {
121                         if (other.actor != null)
122                                 return false;
123                 } else if (!actor.equals(other.actor))
124                         return false;
125                 if (controlLoopName == null) {
126                         if (other.controlLoopName != null)
127                                 return false;
128                 } else if (!controlLoopName.equals(other.controlLoopName))
129                         return false;
130                 if (recipe == null) {
131                         if (other.recipe != null)
132                                 return false;
133                 } else if (!recipe.equals(other.recipe))
134                         return false;
135                 if (targets == null) {
136                         if (other.targets != null)
137                                 return false;
138                 } else if (!targets.equals(other.targets))
139                         return false;
140                 return true;
141         }
142 }