Sonar Fixes policy/models, removing model-yaml
[policy/models.git] / models-interactions / model-yaml / src / main / java / org / onap / policy / controlloop / policy / Target.java
1 /*-
2 /*-
3  * ============LICENSE_START=======================================================
4  * policy-yaml
5  * ================================================================================
6  * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
7  * Modifications Copyright (C) 2019 Tech Mahindra
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.policy.controlloop.policy;
24
25 import java.io.Serializable;
26
27 public class Target implements Serializable {
28
29     private static final long serialVersionUID = 2180988443264988319L;
30
31     private String resourceId;
32     private TargetType type;
33
34     private String modelInvariantId;
35     private String modelVersionId;
36     private String modelName;
37     private String modelVersion;
38     private String modelCustomizationId;
39
40     public Target() {
41         //Does Nothing Empty Constructor
42     }
43
44     public Target(TargetType type) {
45         this.type = type;
46     }
47
48     public Target(String resourceId) {
49         this.resourceId = resourceId;
50     }
51
52     public Target(TargetType type, String resourceId) {
53         this.type = type;
54         this.resourceId = resourceId;
55     }
56
57     public Target(Target target) {
58         this.type = target.type;
59         this.resourceId = target.resourceId;
60     }
61
62     public String getModelInvariantId() {
63         return modelInvariantId;
64     }
65
66     public void setModelInvariantId(String modelInvariantId) {
67         this.modelInvariantId = modelInvariantId;
68     }
69
70     public String getModelVersionId() {
71         return modelVersionId;
72     }
73
74     public void setModelVersionId(String modelVersionId) {
75         this.modelVersionId = modelVersionId;
76     }
77
78     public String getModelName() {
79         return modelName;
80     }
81
82     public void setModelName(String modelName) {
83         this.modelName = modelName;
84     }
85
86     public String getModelVersion() {
87         return modelVersion;
88     }
89
90     public void setModelVersion(String modelVersion) {
91         this.modelVersion = modelVersion;
92     }
93
94     public String getModelCustomizationId() {
95         return modelCustomizationId;
96     }
97
98     public void setModelCustomizationId(String modelCustomizationId) {
99         this.modelCustomizationId = modelCustomizationId;
100     } //techm
101
102     public String getResourceID() {
103         return resourceId;
104     }
105
106     public void setResourceID(String resourceId) {
107         this.resourceId = resourceId;
108     }
109
110     public TargetType getType() {
111         return type;
112     }
113
114     public void setType(TargetType type) {
115         this.type = type;
116     }
117
118     @Override
119     public String toString() {
120         return "Target [type=" + type + ", resourceId=" + resourceId + "]";
121     }
122
123     @Override
124     public int hashCode() {
125         final int prime = 31;
126         int result = 1;
127         result = prime * result + ((type == null) ? 0 : type.hashCode());
128         result = prime * result + ((resourceId == null) ? 0 : resourceId.hashCode());
129         return result;
130     }
131
132     @Override
133     public boolean equals(Object obj) {
134         if (this == obj) {
135             return true;
136         }
137         if (obj == null) {
138             return false;
139         }
140         if (getClass() != obj.getClass()) {
141             return false;
142         }
143         Target other = (Target) obj;
144         if (type == null) {
145             if (other.type != null) {
146                 return false;
147             }
148         } else if (!type.equals(other.type)) {
149             return false;
150         }
151         if (resourceId == null) {
152             if (other.resourceId != null) {
153                 return false;
154             }
155         } else if (!resourceId.equals(other.resourceId)) {
156             return false;
157         }
158         return true;
159     }
160 }