Support for Test Topology Auto Design- Service Import
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / info / ServiceVersionInfo.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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.openecomp.sdc.be.info;
22
23 import com.google.common.annotations.VisibleForTesting;
24 import lombok.Getter;
25 import lombok.Setter;
26
27 @Getter
28 @Setter
29 public class ServiceVersionInfo {
30     private String version;
31     private String url;
32
33     @VisibleForTesting
34     ServiceVersionInfo() {}
35
36     public ServiceVersionInfo(String serviceName, String serviceVersion, String context) {
37         super();
38         this.version = serviceVersion;
39         StringBuilder sb = new StringBuilder(context);
40         sb.append("services/").append(serviceName).append("/").append(serviceVersion);
41         url = sb.toString();
42     }
43
44
45     private String artifactUuid;
46     private String state;
47     private String distributionStatus;
48
49
50     public static Builder newBuilder() {
51         return new Builder();
52     }
53
54     public String getArtifactUuid() {
55         return artifactUuid;
56     }
57     public String getState() {
58         return state;
59     }
60     public String getDistributionStatus() { return distributionStatus; }
61
62
63     public static class Builder {
64         private final ServiceVersionInfo instance;
65
66         private Builder() {
67             instance = new ServiceVersionInfo();
68         }
69
70         public Builder artifactUuid(String artifactUuid) {
71             instance.artifactUuid = artifactUuid;
72             return this;
73         }
74
75         public Builder state(String state) {
76             instance.state = state;
77             return this;
78         }
79
80         public Builder version(String version) {
81             instance.version = version;
82             return this;
83         }
84
85         public Builder distributionStatus(String distributionStatus) {
86             instance.distributionStatus = distributionStatus;
87             return this;
88         }
89
90         public ServiceVersionInfo build() {
91             return instance;
92         }
93     }
94 }