Upgrade sonar plugin
[vid.git] / vid-app-common / src / main / java / org / openecomp / vid / asdc / beans / Resource.java
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * VID\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
10  * \r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * \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
19  */\r
20 \r
21 package org.openecomp.vid.asdc.beans;\r
22 \r
23 import java.util.Collection;\r
24 import java.util.UUID;\r
25 \r
26 /**\r
27  * The Class Resource.\r
28  */\r
29 public class Resource {\r
30 \r
31         /**\r
32          * The Enum Type.\r
33          */\r
34         public enum Type { \r
35                 \r
36                 /** The vf. */\r
37                 VF, \r
38                 \r
39                 /** The vfc. */\r
40                 VFC, \r
41                 \r
42                 /** The cp. */\r
43                 CP, \r
44                 \r
45                 /** The vl. */\r
46                 VL,\r
47                 \r
48                 /** The vfcmt. */\r
49                 VFCMT\r
50         }\r
51         \r
52         /**\r
53          * The Enum LifecycleState.\r
54          */\r
55         public enum LifecycleState {\r
56                 \r
57                 /** The not certified checkout. */\r
58                 NOT_CERTIFIED_CHECKOUT,\r
59                 \r
60                 /** The not certified checkin. */\r
61                 NOT_CERTIFIED_CHECKIN,\r
62                 \r
63                 /** The ready for certification. */\r
64                 READY_FOR_CERTIFICATION,\r
65                 \r
66                 /** The certification in progress. */\r
67                 CERTIFICATION_IN_PROGRESS,\r
68                 \r
69                 /** The certified. */\r
70                 CERTIFIED\r
71         }\r
72         \r
73         /** The uuid. */\r
74         private String uuid;\r
75         \r
76         /** The invariant UUID. */\r
77         private String invariantUUID;\r
78         \r
79         /** The name. */\r
80         private String name;\r
81         \r
82         /** The description. */\r
83         private String description;\r
84         \r
85         /** The version. */\r
86         private String version;\r
87         \r
88         /** The tosca model URL. */\r
89         private String toscaModelURL;\r
90         \r
91         /** The category. */\r
92         private String category;\r
93         \r
94         /** The sub category. */\r
95         private String subCategory;\r
96         \r
97         /** The resource type. */\r
98         private Resource.Type resourceType;\r
99         \r
100         /** The lifecycle state. */\r
101         private Resource.LifecycleState lifecycleState;\r
102         \r
103         /** The last updater user ID. */\r
104         private String lastUpdaterUserId;\r
105         \r
106         /** The last updater full name. */\r
107         private String lastUpdaterFullName;\r
108         \r
109         /** The tosca model. */\r
110         private String toscaModel;\r
111         \r
112         /** The tosca resource name. */\r
113         private String toscaResourceName;\r
114         \r
115         /** The artifacts. */\r
116         private Collection<Artifact> artifacts;\r
117         \r
118         /** The resources. */\r
119         private Collection<SubResource> resources;\r
120         \r
121         /**\r
122          * Gets the uuid.\r
123          *\r
124          * @return the uuid\r
125          */\r
126         public String getUuid() {\r
127                 return uuid;\r
128         }\r
129         \r
130         /**\r
131          * Gets the invariant UUID.\r
132          *\r
133          * @return the invariant UUID\r
134          */\r
135         public String getInvariantUUID() {\r
136                 return invariantUUID;\r
137         }\r
138         \r
139         /**\r
140          * Gets the name.\r
141          *\r
142          * @return the name\r
143          */\r
144         public String getName() {\r
145                 return name;\r
146         }\r
147         \r
148         /**\r
149          * Gets the description.\r
150          *\r
151          * @return the description\r
152          */\r
153         public String getDescription() {\r
154                 return description;\r
155         }\r
156         \r
157         /**\r
158          * Gets the version.\r
159          *\r
160          * @return the version\r
161          */\r
162         public String getVersion() {\r
163                 return version;\r
164         }\r
165         \r
166         /**\r
167          * Gets the tosca model URL.\r
168          *\r
169          * @return the tosca model URL\r
170          */\r
171         public String getToscaModelURL() {\r
172                 return toscaModelURL;\r
173         }\r
174         \r
175         /**\r
176          * Gets the category.\r
177          *\r
178          * @return the category\r
179          */\r
180         public String getCategory() {\r
181                 return category;\r
182         }\r
183         \r
184         /**\r
185          * Gets the sub category.\r
186          *\r
187          * @return the sub category\r
188          */\r
189         public String getSubCategory() {\r
190                 return subCategory;\r
191         }\r
192         \r
193         /**\r
194          * Gets the resource type.\r
195          *\r
196          * @return the resource type\r
197          */\r
198         public Resource.Type getResourceType() {\r
199                 return resourceType;\r
200         }\r
201         \r
202         /**\r
203          * Gets the lifecycle state.\r
204          *\r
205          * @return the lifecycle state\r
206          */\r
207         public Resource.LifecycleState getLifecycleState() {\r
208                 return lifecycleState;\r
209         }\r
210         \r
211         /**\r
212          * Gets the last updater user ID.\r
213          *\r
214          * @return the last updater user ID\r
215          */\r
216         public String getLastUpdaterUserId() {\r
217                 return lastUpdaterUserId;\r
218         }\r
219         \r
220         /**\r
221          * Gets the last updater full name.\r
222          *\r
223          * @return the last updater full name\r
224          */\r
225         public String getLastUpdaterFullName() {\r
226                 return lastUpdaterFullName;\r
227         }\r
228         \r
229         /**\r
230          * Gets the tosca model.\r
231          *\r
232          * @return the tosca model\r
233          */\r
234         public String getToscaModel() {\r
235                 return toscaModel;\r
236         }\r
237         \r
238         /**\r
239          * Gets the tosca resource name.\r
240          *\r
241          * @return the tosca resource name\r
242          */\r
243         public String getToscaResourceName() {\r
244                 return toscaResourceName;\r
245         }\r
246         \r
247         /**\r
248          * Gets the artifacts.\r
249          *\r
250          * @return the artifacts\r
251          */\r
252         public Collection<Artifact> getArtifacts() {\r
253                 return artifacts;\r
254         }\r
255         \r
256         /**\r
257          * Gets the resources.\r
258          *\r
259          * @return the resources\r
260          */\r
261         public Collection<SubResource> getResources() {\r
262                 return resources;\r
263         }\r
264         \r
265         /**\r
266          * Sets the uuid.\r
267          *\r
268          * @param uuid the new uuid\r
269          */\r
270         public void setUuid(String uuid) {\r
271                 this.uuid = uuid;\r
272         }\r
273         \r
274         /**\r
275          * Sets the invariant UUID.\r
276          *\r
277          * @param invariantUUID the new invariant UUID\r
278          */\r
279         public void setInvariantUUID(String invariantUUID) {\r
280                 this.invariantUUID = invariantUUID;\r
281         }\r
282         \r
283         /**\r
284          * Sets the name.\r
285          *\r
286          * @param name the new name\r
287          */\r
288         public void setName(String name) {\r
289                 this.name = name;\r
290         }\r
291         /**\r
292          * Sets the description.\r
293          *\r
294          * @param name the new description\r
295          */\r
296         public void setDescription(String description) {\r
297                 this.description = description;\r
298         }\r
299         /**\r
300          * Sets the version.\r
301          *\r
302          * @param version the new version\r
303          */\r
304         public void setVersion(String version) {\r
305                 this.version = version;\r
306         }\r
307         \r
308         /**\r
309          * Sets the tosca model URL.\r
310          *\r
311          * @param toscaModelURL the new tosca model URL\r
312          */\r
313         public void setToscaModelURL(String toscaModelURL) {\r
314                 this.toscaModelURL = toscaModelURL;\r
315         }\r
316         \r
317         /**\r
318          * Sets the category.\r
319          *\r
320          * @param category the new category\r
321          */\r
322         public void setCategory(String category) {\r
323                 this.category = category;\r
324         }\r
325         \r
326         /**\r
327          * Sets the sub category.\r
328          *\r
329          * @param subCategory the new sub category\r
330          */\r
331         public void setSubCategory(String subCategory) {\r
332                 this.subCategory = subCategory;\r
333         }\r
334         \r
335         /**\r
336          * Sets the resource type.\r
337          *\r
338          * @param resourceType the new resource type\r
339          */\r
340         public void setResourceType(Resource.Type resourceType) {\r
341                 this.resourceType = resourceType;\r
342         }\r
343         \r
344         /**\r
345          * Sets the lifecycle state.\r
346          *\r
347          * @param lifecycleState the new lifecycle state\r
348          */\r
349         public void setLifecycleState(Resource.LifecycleState lifecycleState) {\r
350                 this.lifecycleState = lifecycleState;\r
351         }\r
352         \r
353         /**\r
354          * Sets the last updater user ID.\r
355          *\r
356          * @param lastUpdaterUserId the new last updater user ID\r
357          */\r
358         public void setLastUpdaterUserId(String lastUpdaterUserId) {\r
359                 this.lastUpdaterUserId = lastUpdaterUserId;\r
360         }\r
361         \r
362         /**\r
363          * Sets the last updater full name.\r
364          *\r
365          * @param lastUpdaterFullName the new last updater full name\r
366          */\r
367         public void setLastUpdaterFullName(String lastUpdaterFullName) {\r
368                 this.lastUpdaterFullName = lastUpdaterFullName;\r
369         }\r
370         \r
371         /**\r
372          * Sets the tosca model.\r
373          *\r
374          * @param toscaModel the new tosca model\r
375          */\r
376         public void setToscaModel(String toscaModel) {\r
377                 this.toscaModel = toscaModel;\r
378         }\r
379         \r
380         /**\r
381          * Sets the tosca resource name.\r
382          *\r
383          * @param toscaResourceName the new tosca resource name\r
384          */\r
385         public void setToscaResourceName(String toscaResourceName) {\r
386                 this.toscaResourceName = toscaResourceName;\r
387         }\r
388         \r
389         /**\r
390          * Sets the artifacts.\r
391          *\r
392          * @param artifacts the new artifacts\r
393          */\r
394         public void setArtifacts(Collection<Artifact> artifacts) {\r
395                 this.artifacts = artifacts;\r
396         }\r
397         \r
398         /**\r
399          * Sets the resources.\r
400          *\r
401          * @param resources the new resources\r
402          */\r
403         public void setResources(Collection<SubResource> resources) {\r
404                 this.resources = resources;\r
405         }\r
406 \r
407         /* (non-Javadoc)\r
408          * @see java.lang.Object#hashCode()\r
409          */\r
410         @Override\r
411         public int hashCode() {\r
412                 final UUID uuid = UUID.fromString(getUuid());\r
413                 \r
414                 return uuid.hashCode();\r
415         }\r
416         \r
417         /* (non-Javadoc)\r
418          * @see java.lang.Object#equals(java.lang.Object)\r
419          */\r
420         @Override\r
421         public boolean equals(Object o) {\r
422                 if (o == this) return true;\r
423                 if (!(o instanceof Resource)) return false;\r
424                 \r
425                 final Resource resource = (Resource) o;\r
426                 \r
427                 return (resource.getUuid().equals(getUuid()));\r
428         }\r
429 }\r