2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.vid.asdc.beans;
23 import java.util.Collection;
24 import java.util.UUID;
29 public class Resource {
53 * The Enum LifecycleState.
55 public enum LifecycleState {
57 /** The not certified checkout. */
58 NOT_CERTIFIED_CHECKOUT,
60 /** The not certified checkin. */
61 NOT_CERTIFIED_CHECKIN,
63 /** The ready for certification. */
64 READY_FOR_CERTIFICATION,
66 /** The certification in progress. */
67 CERTIFICATION_IN_PROGRESS,
76 /** The invariant UUID. */
77 private String invariantUUID;
82 /** The description. */
83 private String description;
86 private String version;
88 /** The tosca model URL. */
89 private String toscaModelURL;
92 private String category;
94 /** The sub category. */
95 private String subCategory;
97 /** The resource type. */
98 private Resource.Type resourceType;
100 /** The lifecycle state. */
101 private Resource.LifecycleState lifecycleState;
103 /** The last updater user ID. */
104 private String lastUpdaterUserId;
106 /** The last updater full name. */
107 private String lastUpdaterFullName;
109 /** The tosca model. */
110 private String toscaModel;
112 /** The tosca resource name. */
113 private String toscaResourceName;
115 /** The artifacts. */
116 private Collection<Artifact> artifacts;
118 /** The resources. */
119 private Collection<SubResource> resources;
126 public String getUuid() {
131 * Gets the invariant UUID.
133 * @return the invariant UUID
135 public String getInvariantUUID() {
136 return invariantUUID;
144 public String getName() {
149 * Gets the description.
151 * @return the description
153 public String getDescription() {
160 * @return the version
162 public String getVersion() {
167 * Gets the tosca model URL.
169 * @return the tosca model URL
171 public String getToscaModelURL() {
172 return toscaModelURL;
178 * @return the category
180 public String getCategory() {
185 * Gets the sub category.
187 * @return the sub category
189 public String getSubCategory() {
194 * Gets the resource type.
196 * @return the resource type
198 public Resource.Type getResourceType() {
203 * Gets the lifecycle state.
205 * @return the lifecycle state
207 public Resource.LifecycleState getLifecycleState() {
208 return lifecycleState;
212 * Gets the last updater user ID.
214 * @return the last updater user ID
216 public String getLastUpdaterUserId() {
217 return lastUpdaterUserId;
221 * Gets the last updater full name.
223 * @return the last updater full name
225 public String getLastUpdaterFullName() {
226 return lastUpdaterFullName;
230 * Gets the tosca model.
232 * @return the tosca model
234 public String getToscaModel() {
239 * Gets the tosca resource name.
241 * @return the tosca resource name
243 public String getToscaResourceName() {
244 return toscaResourceName;
248 * Gets the artifacts.
250 * @return the artifacts
252 public Collection<Artifact> getArtifacts() {
257 * Gets the resources.
259 * @return the resources
261 public Collection<SubResource> getResources() {
268 * @param uuid the new uuid
270 public void setUuid(String uuid) {
275 * Sets the invariant UUID.
277 * @param invariantUUID the new invariant UUID
279 public void setInvariantUUID(String invariantUUID) {
280 this.invariantUUID = invariantUUID;
286 * @param name the new name
288 public void setName(String name) {
292 * Sets the description.
294 * @param name the new description
296 public void setDescription(String description) {
297 this.description = description;
302 * @param version the new version
304 public void setVersion(String version) {
305 this.version = version;
309 * Sets the tosca model URL.
311 * @param toscaModelURL the new tosca model URL
313 public void setToscaModelURL(String toscaModelURL) {
314 this.toscaModelURL = toscaModelURL;
320 * @param category the new category
322 public void setCategory(String category) {
323 this.category = category;
327 * Sets the sub category.
329 * @param subCategory the new sub category
331 public void setSubCategory(String subCategory) {
332 this.subCategory = subCategory;
336 * Sets the resource type.
338 * @param resourceType the new resource type
340 public void setResourceType(Resource.Type resourceType) {
341 this.resourceType = resourceType;
345 * Sets the lifecycle state.
347 * @param lifecycleState the new lifecycle state
349 public void setLifecycleState(Resource.LifecycleState lifecycleState) {
350 this.lifecycleState = lifecycleState;
354 * Sets the last updater user ID.
356 * @param lastUpdaterUserId the new last updater user ID
358 public void setLastUpdaterUserId(String lastUpdaterUserId) {
359 this.lastUpdaterUserId = lastUpdaterUserId;
363 * Sets the last updater full name.
365 * @param lastUpdaterFullName the new last updater full name
367 public void setLastUpdaterFullName(String lastUpdaterFullName) {
368 this.lastUpdaterFullName = lastUpdaterFullName;
372 * Sets the tosca model.
374 * @param toscaModel the new tosca model
376 public void setToscaModel(String toscaModel) {
377 this.toscaModel = toscaModel;
381 * Sets the tosca resource name.
383 * @param toscaResourceName the new tosca resource name
385 public void setToscaResourceName(String toscaResourceName) {
386 this.toscaResourceName = toscaResourceName;
390 * Sets the artifacts.
392 * @param artifacts the new artifacts
394 public void setArtifacts(Collection<Artifact> artifacts) {
395 this.artifacts = artifacts;
399 * Sets the resources.
401 * @param resources the new resources
403 public void setResources(Collection<SubResource> resources) {
404 this.resources = resources;
408 * @see java.lang.Object#hashCode()
411 public int hashCode() {
412 final UUID uuid = UUID.fromString(getUuid());
414 return uuid.hashCode();
418 * @see java.lang.Object#equals(java.lang.Object)
421 public boolean equals(Object o) {
422 if (o == this) return true;
423 if (!(o instanceof Resource)) return false;
425 final Resource resource = (Resource) o;
427 return (resource.getUuid().equals(getUuid()));