2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 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
11 * http://www.apache.org/licenses/LICENSE-2.0
\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
21 package org.onap.policy.controlloop.policy.guard;
\r
23 import java.util.LinkedList;
\r
24 import java.util.List;
\r
27 public class MatchParameters {
\r
28 private String controlLoopName;
\r
29 private String actor;
\r
30 private String recipe;
\r
31 private List<String> targets;
\r
33 public MatchParameters() {
\r
34 // Do Nothing Empty Constructor.
\r
37 public String getControlLoopName() {
\r
38 return controlLoopName;
\r
41 public void setControlLoopName(String controlLoopName) {
\r
42 this.controlLoopName = controlLoopName;
\r
45 public String getActor() {
\r
49 public void setActor(String actor) {
\r
53 public String getRecipe() {
\r
57 public void setRecipe(String recipe) {
\r
58 this.recipe = recipe;
\r
61 public List<String> getTargets() {
\r
65 public void setTargets(List<String> targets) {
\r
66 this.targets = targets;
\r
69 public MatchParameters(String actor, String recipe) {
\r
71 this.recipe = recipe;
\r
74 public MatchParameters(String actor, String recipe, List<String> targets) {
\r
75 this(actor, recipe);
\r
76 if (targets != null) {
\r
77 this.targets = new LinkedList<>(targets);
\r
81 public MatchParameters(String controlLoopName, String actor, String recipe, List<String> targets) {
\r
82 this(actor, recipe, targets);
\r
83 this.controlLoopName = controlLoopName;
\r
86 public MatchParameters(MatchParameters matchParameters) {
\r
88 this.controlLoopName = matchParameters.controlLoopName;
\r
89 this.actor = matchParameters.actor;
\r
90 this.recipe = matchParameters.recipe;
\r
91 if (matchParameters.targets != null) {
\r
92 this.targets = new LinkedList<>(matchParameters.targets);
\r
97 public String toString() {
\r
98 return "MatchParameters [controlLoopName=" + controlLoopName + ", actor=" + actor + ", recipe=" + recipe
\r
99 + ", targets=" + targets + "]";
\r
103 public int hashCode() {
\r
104 final int prime = 31;
\r
106 result = prime * result + ((actor == null) ? 0 : actor.hashCode());
\r
107 result = prime * result + ((controlLoopName == null) ? 0 : controlLoopName.hashCode());
\r
108 result = prime * result + ((recipe == null) ? 0 : recipe.hashCode());
\r
109 result = prime * result + ((targets == null) ? 0 : targets.hashCode());
\r
114 public boolean equals(Object obj) {
\r
119 if (getClass() != obj.getClass())
\r
121 MatchParameters other = (MatchParameters) obj;
\r
123 return equalsMayBeNull(actor, other.actor)
\r
124 && equalsMayBeNull(controlLoopName, other.controlLoopName)
\r
125 && equalsMayBeNull(recipe, other.recipe)
\r
126 && equalsMayBeNull(targets, other.targets);
\r
129 private boolean equalsMayBeNull(final Object obj1, final Object obj2){
\r
130 if ( obj1 == null ) {
\r
131 return obj2 == null;
\r
133 return obj1.equals(obj2);
\r