remove dependency of drool-application/yaml in actors
[policy/models.git] / models-interactions / model-yaml / src / main / java / org / onap / policy / controlloop / policy / Target.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * policy-yaml
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * Modifications Copyright (C) 2019 Nordix Foundation.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  * 
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  * 
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.controlloop.policy;
23
24 import java.io.Serializable;
25
26 public class Target implements Serializable {
27
28     private static final long serialVersionUID = 2180988443264988319L;
29      
30     private String resourceId;
31     private TargetType type;
32
33     public Target() {
34         //Does Nothing Empty Constructor
35     }
36     
37     public Target(TargetType type) {
38         this.type = type;
39     }
40     
41     public Target(String resourceId) {
42         this.resourceId = resourceId;
43     }
44     
45     public Target(TargetType type, String resourceId) {
46         this.type = type;
47         this.resourceId = resourceId;
48     }
49     
50     public Target(Target target) {
51         this.type = target.type;
52         this.resourceId = target.resourceId;
53     }
54     
55     public String getResourceID() {
56         return resourceId;
57     }
58
59     public void setResourceID(String resourceId) {
60         this.resourceId = resourceId;
61     }
62
63     public TargetType getType() {
64         return type;
65     }
66
67     public void setType(TargetType type) {
68         this.type = type;
69     }
70
71     @Override
72     public String toString() {
73         return "Target [type=" + type + ", resourceId=" + resourceId + "]";
74     }
75     
76     @Override
77     public int hashCode() {
78         final int prime = 31;
79         int result = 1;
80         result = prime * result + ((type == null) ? 0 : type.hashCode());
81         result = prime * result + ((resourceId == null) ? 0 : resourceId.hashCode());
82         return result;
83     }
84     
85     @Override
86     public boolean equals(Object obj) {
87         if (this == obj) {
88             return true;
89         }
90         if (obj == null) {
91             return false;
92         }
93         if (getClass() != obj.getClass()) {
94             return false;
95         }
96         Target other = (Target) obj;
97         if (type == null) {
98             if (other.type != null) {
99                 return false;
100             }
101         } else if (!type.equals(other.type)) {
102             return false;
103         }
104         if (resourceId == null) {
105             if (other.resourceId != null) {
106                 return false;
107             }
108         } else if (!resourceId.equals(other.resourceId)) {
109             return false;
110         }
111         return true;
112     }
113 }