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