2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 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 Service {
32 * The Enum DistributionStatus.
34 public enum DistributionStatus {
36 /** The distribution not approved. */
37 DISTRIBUTION_NOT_APPROVED,
39 /** The distribution approved. */
40 DISTRIBUTION_APPROVED,
42 /** The distributed. */
45 /** The distribution rejected. */
46 DISTRIBUTION_REJECTED,
48 /** The destributed for tenant isolation. */
49 DISTRIBUTION_COMPLETE_OK
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;
83 private String version;
85 /** The tosca model URL. */
86 private String toscaModelURL;
89 private String category;
91 /** The lifecycle state. */
92 private Service.LifecycleState lifecycleState;
94 /** The last updater user uid. */
95 private String lastUpdaterUserId;
97 /** The last updater full name. */
98 private String lastUpdaterFullName;
100 /** The distribution status. */
101 private String distributionStatus;
103 /** The artifacts. */
104 private Collection<Artifact> artifacts;
106 /** The resources. */
107 private Collection<SubResource> resources;
110 public static class ServiceBuilder {
112 private String invariantUUID;
114 private String version;
115 private String toscaModelURL;
116 private String category;
117 private Service.LifecycleState lifecycleState;
118 private String distributionStatus;
119 private Collection<Artifact> artifacts;
120 private Collection<SubResource> resources;
122 public ServiceBuilder setUuid(String uuid) {
127 public ServiceBuilder setInvariantUUID(String invariantUUID) {
128 this.invariantUUID = invariantUUID;
132 public ServiceBuilder setName(String name) {
137 public ServiceBuilder setVersion(String version) {
138 this.version = version;
142 public ServiceBuilder setToscaModelURL(String toscaModelURL) {
143 this.toscaModelURL = toscaModelURL;
147 public ServiceBuilder setCategory(String category) {
148 this.category = category;
152 public ServiceBuilder setLifecycleState(Service.LifecycleState lifecycleState) {
153 this.lifecycleState = lifecycleState;
157 public ServiceBuilder setDistributionStatus(String distributionStatus) {
158 this.distributionStatus = distributionStatus;
162 public ServiceBuilder setArtifacts(Collection<Artifact> artifacts) {
163 this.artifacts = artifacts;
167 public ServiceBuilder setResources(Collection<SubResource> resources) {
168 this.resources = resources;
172 public Service build() {
173 return new Service(this);
183 public String getUuid() {
188 * Gets the invariant UUID.
190 * @return the invariant UUID
192 public String getInvariantUUID() {
193 return invariantUUID;
201 public String getName() {
208 * @return the version
210 public String getVersion() {
215 * Gets the tosca model URL.
217 * @return the tosca model URL
219 public String getToscaModelURL() {
220 return toscaModelURL;
226 * @return the category
228 public String getCategory() {
233 * Gets the lifecycle state.
235 * @return the lifecycle state
237 public Service.LifecycleState getLifecycleState() {
238 return lifecycleState;
242 * Gets the last updater user uid.
244 * @return the last updater user uid
246 public String getLastUpdaterUserId() {
247 return lastUpdaterUserId;
251 * Gets the last updater full name.
253 * @return the last updater full name
255 public String getLastUpdaterFullName() {
256 return lastUpdaterFullName;
260 * Gets the distribution status.
262 * @return the distribution status
264 public String getDistributionStatus() {
265 return distributionStatus;
269 * Gets the artifacts.
271 * @return the artifacts
273 public Collection<Artifact> getArtifacts() {
278 * Gets the resources.
280 * @return the resources
282 public Collection<SubResource> getResources() {
289 * @param uuid the new uuid
291 public void setUuid(String uuid) {
296 * Sets the invariant UUID.
298 * @param invariantUUID the new invariant UUID
300 public void setInvariantUUID(String invariantUUID) {
301 this.invariantUUID = invariantUUID;
307 * @param name the new name
309 public void setName(String name) {
316 * @param version the new version
318 public void setVersion(String version) {
319 this.version = version;
323 * Sets the tosca model URL.
325 * @param toscaModelURL the new tosca model URL
327 public void setToscaModelURL(String toscaModelURL) {
328 this.toscaModelURL = toscaModelURL;
334 * @param category the new category
336 public void setCategory(String category) {
337 this.category = category;
341 * Sets the lifecycle state.
343 * @param lifecycleState the new lifecycle state
345 public void setLifecycleState(Service.LifecycleState lifecycleState) {
346 this.lifecycleState = lifecycleState;
350 * Sets the last updater user uid.
352 * @param lastUpdaterUserId the new last updater user uid
354 public void set(String lastUpdaterUserId) {
355 this.lastUpdaterUserId = lastUpdaterUserId;
359 * Sets the last updater full name.
361 * @param lastUpdaterFullName the new last updater full name
363 public void setLastUpdaterFullName(String lastUpdaterFullName) {
364 this.lastUpdaterFullName = lastUpdaterFullName;
368 * Sets the distribution status.
370 * @param distributionStatus the new distribution status
372 public void setDistributionStatus(String distributionStatus) {
373 this.distributionStatus = distributionStatus;
377 * Sets the artifacts.
379 * @param artifacts the new artifacts
381 public void setArtifacts(Collection<Artifact> artifacts) {
382 this.artifacts = artifacts;
386 * Sets the resources.
388 * @param resources the new resources
390 public void setResources(Collection<SubResource> resources) {
391 this.resources = resources;
397 * @see java.lang.Object#toString()
400 public String toString() {
407 * @see java.lang.Object#hashCode()
410 public int hashCode() {
411 return UUID.fromString(getUuid()).hashCode();
417 * @see java.lang.Object#equals(java.lang.Object)
420 public boolean equals(Object o) {
423 if (!(o instanceof Service))
426 final Service service = (Service) o;
428 return (service.getUuid().equals(getUuid()));
433 public Service(ServiceBuilder serviceBuilder) {
435 this.uuid = serviceBuilder.uuid;
436 this.invariantUUID = serviceBuilder.invariantUUID;
437 this.name = serviceBuilder.name;
438 this.version = serviceBuilder.version;
439 this.toscaModelURL = serviceBuilder.toscaModelURL;
440 this.category = serviceBuilder.category;
441 this.lifecycleState = serviceBuilder.lifecycleState;
442 this.distributionStatus = serviceBuilder.distributionStatus;
443 this.artifacts = serviceBuilder.artifacts;
444 this.resources = serviceBuilder.resources;