Commit includes ControlLoopPolicy API and bugfixes
[policy/engine.git] / ECOMP-ControlloopPolicy / src / main / java / org / openecomp / policy / controlloop / policy / Target.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 package org.openecomp.policy.controlloop.policy;
21
22 import java.io.Serializable;
23
24 public class Target implements Serializable {
25
26         /**
27          * 
28          */
29         private static final long serialVersionUID = 2180988443264988319L;
30          
31         private String resourceID;
32         private TargetType type;
33
34         public Target() {
35                 //Does Nothing Empty Constructor
36         }
37         
38         public String getResourceID() {
39                 return resourceID;
40         }
41
42         public void setResourceID(String resourceID) {
43                 this.resourceID = resourceID;
44         }
45
46         public TargetType getType() {
47                 return type;
48         }
49
50         public void setType(TargetType type) {
51                 this.type = type;
52         }
53
54         public Target(TargetType type) {
55                 this.type = type;
56         }
57         
58         public Target(String resourceID) {
59                 this.resourceID = resourceID;
60         }
61         
62         public Target(TargetType type, String resourceID) {
63                 this.type = type;
64                 this.resourceID = resourceID;
65         }
66         
67         public Target(Target target) {
68                 this.type = target.type;
69                 this.resourceID = target.resourceID;
70         }
71         
72         @Override
73         public String toString() {
74                 return "Target [type=" + type + ", resourceID=" + resourceID + "]";
75         }
76         
77         @Override
78         public int hashCode() {
79                 final int prime = 31;
80                 int result = 1;
81                 result = prime * result + ((type == null) ? 0 : type.hashCode());
82                 result = prime * result + ((resourceID == null) ? 0 : resourceID.hashCode());
83                 return result;
84         }
85         @Override
86         public boolean equals(Object obj) {
87                 if (this == obj)
88                         return true;
89                 if (obj == null)
90                         return false;
91                 if (getClass() != obj.getClass())
92                         return false;
93                 Target other = (Target) obj;
94                 if (type == null) {
95                         if (other.type != null)
96                                 return false;
97                 } else if (!type.equals(other.type))
98                         return false;
99                 if (resourceID == null) {
100                         if (other.resourceID != null)
101                                 return false;
102                 } else if (!resourceID.equals(other.resourceID))
103                         return false;
104                 return true;
105         }
106 }