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;
26 public class Service {
28 public enum DistributionStatus {
30 DISTRIBUTION_NOT_APPROVED,
32 DISTRIBUTION_APPROVED,
36 DISTRIBUTION_REJECTED,
38 DISTRIBUTION_COMPLETE_OK
41 public enum LifecycleState {
43 NOT_CERTIFIED_CHECKOUT,
45 NOT_CERTIFIED_CHECKIN,
47 READY_FOR_CERTIFICATION,
49 CERTIFICATION_IN_PROGRESS,
56 private String invariantUUID;
60 private String version;
62 private String toscaModelURL;
64 private String category;
66 private Service.LifecycleState lifecycleState;
68 private String lastUpdaterUserId;
70 private String lastUpdaterFullName;
72 private String distributionStatus;
74 private Collection<Artifact> artifacts;
76 private Collection<SubResource> resources;
78 private String orchestrationType;
80 private Boolean isInstantiationTemplateExists;
83 public static class ServiceBuilder {
85 private String invariantUUID;
87 private String version;
88 private String toscaModelURL;
89 private String category;
90 private Service.LifecycleState lifecycleState;
91 private String distributionStatus;
92 private Collection<Artifact> artifacts;
93 private Collection<SubResource> resources;
94 private String orchestrationType;
96 public ServiceBuilder setUuid(String uuid) {
101 public ServiceBuilder setInvariantUUID(String invariantUUID) {
102 this.invariantUUID = invariantUUID;
106 public ServiceBuilder setName(String name) {
111 public ServiceBuilder setVersion(String version) {
112 this.version = version;
116 public ServiceBuilder setToscaModelURL(String toscaModelURL) {
117 this.toscaModelURL = toscaModelURL;
121 public ServiceBuilder setCategory(String category) {
122 this.category = category;
126 public ServiceBuilder setLifecycleState(Service.LifecycleState lifecycleState) {
127 this.lifecycleState = lifecycleState;
131 public ServiceBuilder setDistributionStatus(String distributionStatus) {
132 this.distributionStatus = distributionStatus;
136 public ServiceBuilder setArtifacts(Collection<Artifact> artifacts) {
137 this.artifacts = artifacts;
141 public ServiceBuilder setResources(Collection<SubResource> resources) {
142 this.resources = resources;
146 public ServiceBuilder setOrchestrationType(String orchestrationType) {
147 this.orchestrationType = orchestrationType;
151 public Service build() {
152 return new Service(this);
157 public String getUuid() {
161 public String getInvariantUUID() {
162 return invariantUUID;
165 public String getName() {
169 public String getVersion() {
173 public String getToscaModelURL() {
174 return toscaModelURL;
177 public String getCategory() {
181 public Service.LifecycleState getLifecycleState() {
182 return lifecycleState;
185 public String getLastUpdaterUserId() {
186 return lastUpdaterUserId;
189 public String getLastUpdaterFullName() {
190 return lastUpdaterFullName;
193 public String getDistributionStatus() {
194 return distributionStatus;
197 public Collection<Artifact> getArtifacts() {
201 public Collection<SubResource> getResources() {
205 public String getOrchestrationType() {
206 return orchestrationType;
209 public Boolean getIsInstantiationTemplateExists() {
210 return isInstantiationTemplateExists;
214 public void setUuid(String uuid) {
218 public void setInvariantUUID(String invariantUUID) {
219 this.invariantUUID = invariantUUID;
222 public void setName(String name) {
226 public void setVersion(String version) {
227 this.version = version;
230 public void setToscaModelURL(String toscaModelURL) {
231 this.toscaModelURL = toscaModelURL;
234 public void setCategory(String category) {
235 this.category = category;
238 public void setLifecycleState(Service.LifecycleState lifecycleState) {
239 this.lifecycleState = lifecycleState;
242 public void set(String lastUpdaterUserId) {
243 this.lastUpdaterUserId = lastUpdaterUserId;
246 public void setLastUpdaterFullName(String lastUpdaterFullName) {
247 this.lastUpdaterFullName = lastUpdaterFullName;
250 public void setDistributionStatus(String distributionStatus) {
251 this.distributionStatus = distributionStatus;
254 public void setArtifacts(Collection<Artifact> artifacts) {
255 this.artifacts = artifacts;
258 public void setResources(Collection<SubResource> resources) {
259 this.resources = resources;
262 public void setOrchestrationType(String orchestrationType) {
263 this.orchestrationType = orchestrationType;
266 public void setIsInstantiationTemplateExists(Boolean isInstantiationTemplateExists) {
267 this.isInstantiationTemplateExists = isInstantiationTemplateExists;
271 public String toString() {
277 public int hashCode() {
278 return UUID.fromString(getUuid()).hashCode();
282 public boolean equals(Object o) {
285 if (!(o instanceof Service))
288 final Service service = (Service) o;
290 return (service.getUuid().equals(getUuid()));
295 public Service(ServiceBuilder serviceBuilder) {
297 this.uuid = serviceBuilder.uuid;
298 this.invariantUUID = serviceBuilder.invariantUUID;
299 this.name = serviceBuilder.name;
300 this.version = serviceBuilder.version;
301 this.toscaModelURL = serviceBuilder.toscaModelURL;
302 this.category = serviceBuilder.category;
303 this.lifecycleState = serviceBuilder.lifecycleState;
304 this.distributionStatus = serviceBuilder.distributionStatus;
305 this.artifacts = serviceBuilder.artifacts;
306 this.resources = serviceBuilder.resources;
307 this.orchestrationType = serviceBuilder.orchestrationType;