org.onap migration
[vid.git] / vid-app-common / src / main / java / org / onap / vid / asdc / beans / Service.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  * The Class Service.
27  */
28 public class Service {
29
30         /**
31          * The Enum DistributionStatus.
32          */
33         public enum DistributionStatus {
34
35                 /** The distribution not approved. */
36                 DISTRIBUTION_NOT_APPROVED,
37
38                 /** The distribution approved. */
39                 DISTRIBUTION_APPROVED,
40
41                 /** The distributed. */
42                 DISTRIBUTED,
43
44                 /** The distribution rejected. */
45                 DISTRIBUTION_REJECTED,
46
47                 /** The destributed for tenant isolation. */
48                 DISTRIBUTION_COMPLETE_OK
49         }
50
51         /**
52          * The Enum LifecycleState.
53          */
54         public enum LifecycleState {
55
56                 /** The not certified checkout. */
57                 NOT_CERTIFIED_CHECKOUT,
58
59                 /** The not certified checkin. */
60                 NOT_CERTIFIED_CHECKIN,
61
62                 /** The ready for certification. */
63                 READY_FOR_CERTIFICATION,
64
65                 /** The certification in progress. */
66                 CERTIFICATION_IN_PROGRESS,
67
68                 /** The certified. */
69                 CERTIFIED
70         }
71
72         /** The uuid. */
73         private String uuid;
74
75         /** The invariant UUID. */
76         private String invariantUUID;
77
78         /** The name. */
79         private String name;
80
81         /** The version. */
82         private String version;
83
84         /** The tosca model URL. */
85         private String toscaModelURL;
86
87         /** The category. */
88         private String category;
89
90         /** The lifecycle state. */
91         private Service.LifecycleState lifecycleState;
92
93         /** The last updater user uid. */
94         private String lastUpdaterUserId;
95
96         /** The last updater full name. */
97         private String lastUpdaterFullName;
98
99         /** The distribution status. */
100         private Service.DistributionStatus distributionStatus;
101
102         /** The artifacts. */
103         private Collection<Artifact> artifacts;
104
105         /** The resources. */
106         private Collection<SubResource> resources;
107
108         /**
109          * Gets the uuid.
110          *
111          * @return the uuid
112          */
113         public String getUuid() {
114                 return uuid;
115         }
116
117         /**
118          * Gets the invariant UUID.
119          *
120          * @return the invariant UUID
121          */
122         public String getInvariantUUID() {
123                 return invariantUUID;
124         }
125
126         /**
127          * Gets the name.
128          *
129          * @return the name
130          */
131         public String getName() {
132                 return name;
133         }
134
135         /**
136          * Gets the version.
137          *
138          * @return the version
139          */
140         public String getVersion() {
141                 return version;
142         }
143
144         /**
145          * Gets the tosca model URL.
146          *
147          * @return the tosca model URL
148          */
149         public String getToscaModelURL() {
150                 return toscaModelURL;
151         }
152
153         /**
154          * Gets the category.
155          *
156          * @return the category
157          */
158         public String getCategory() {
159                 return category;
160         }
161
162         /**
163          * Gets the lifecycle state.
164          *
165          * @return the lifecycle state
166          */
167         public Service.LifecycleState getLifecycleState() {
168                 return lifecycleState;
169         }
170
171         /**
172          * Gets the last updater user uid.
173          *
174          * @return the last updater user uid
175          */
176         public String getLastUpdaterUserId() {
177                 return lastUpdaterUserId;
178         }
179
180         /**
181          * Gets the last updater full name.
182          *
183          * @return the last updater full name
184          */
185         public String getLastUpdaterFullName() {
186                 return lastUpdaterFullName;
187         }
188
189         /**
190          * Gets the distribution status.
191          *
192          * @return the distribution status
193          */
194         public Service.DistributionStatus getDistributionStatus() {
195                 return distributionStatus;
196         }
197
198         /**
199          * Gets the artifacts.
200          *
201          * @return the artifacts
202          */
203         public Collection<Artifact> getArtifacts() {
204                 return artifacts;
205         }
206
207         /**
208          * Gets the resources.
209          *
210          * @return the resources
211          */
212         public Collection<SubResource> getResources() {
213                 return resources;
214         }
215
216         /**
217          * Sets the uuid.
218          *
219          * @param uuid the new uuid
220          */
221         public void setUuid(String uuid) {
222                 this.uuid = uuid;
223         }
224
225         /**
226          * Sets the invariant UUID.
227          *
228          * @param invariantUUID the new invariant UUID
229          */
230         public void setInvariantUUID(String invariantUUID) {
231                 this.invariantUUID = invariantUUID;
232         }
233
234         /**
235          * Sets the name.
236          *
237          * @param name the new name
238          */
239         public void setName(String name) {
240                 this.name = name;
241         }
242
243         /**
244          * Sets the version.
245          *
246          * @param version the new version
247          */
248         public void setVersion(String version) {
249                 this.version = version;
250         }
251
252         /**
253          * Sets the tosca model URL.
254          *
255          * @param toscaModelURL the new tosca model URL
256          */
257         public void setToscaModelURL(String toscaModelURL) {
258                 this.toscaModelURL = toscaModelURL;
259         }
260
261         /**
262          * Sets the category.
263          *
264          * @param category the new category
265          */
266         public void setCategory(String category) {
267                 this.category = category;
268         }
269
270         /**
271          * Sets the lifecycle state.
272          *
273          * @param lifecycleState the new lifecycle state
274          */
275         public void setLifecycleState(Service.LifecycleState lifecycleState) {
276                 this.lifecycleState = lifecycleState;
277         }
278
279         /**
280          * Sets the last updater user uid.
281          *
282          * @param lastUpdaterUserId the new last updater user uid
283          */
284         public void set(String lastUpdaterUserId) {
285                 this.lastUpdaterUserId = lastUpdaterUserId;
286         }
287
288         /**
289          * Sets the last updater full name.
290          *
291          * @param lastUpdaterFullName the new last updater full name
292          */
293         public void setLastUpdaterFullName(String lastUpdaterFullName) {
294                 this.lastUpdaterFullName = lastUpdaterFullName;
295         }
296
297         /**
298          * Sets the distribution status.
299          *
300          * @param distributionStatus the new distribution status
301          */
302         public void setDistributionStatus(Service.DistributionStatus distributionStatus) {
303                 this.distributionStatus = distributionStatus;
304         }
305
306         /**
307          * Sets the artifacts.
308          *
309          * @param artifacts the new artifacts
310          */
311         public void setArtifacts(Collection<Artifact> artifacts) {
312                 this.artifacts = artifacts;
313         }
314
315         /**
316          * Sets the resources.
317          *
318          * @param resources the new resources
319          */
320         public void setResources(Collection<SubResource> resources) {
321                 this.resources = resources;
322         }
323
324         /* (non-Javadoc)
325          * @see java.lang.Object#toString()
326          */
327         @Override
328         public String toString() {
329                 return uuid;
330         }
331
332         /* (non-Javadoc)
333          * @see java.lang.Object#hashCode()
334          */
335         @Override
336         public int hashCode() {
337                 final UUID uuid = UUID.fromString(getUuid());
338
339                 return uuid.hashCode();
340         }
341
342         /* (non-Javadoc)
343          * @see java.lang.Object#equals(java.lang.Object)
344          */
345         @Override
346         public boolean equals(Object o) {
347                 if (o == this) return true;
348                 if (!(o instanceof Service)) return false;
349
350                 final Service service = (Service) o;
351
352                 return (service.getUuid().equals(getUuid()));
353         }
354 }