Merge "Fix getManualTasks double-addition of baseUrl"
[vid.git] / vid-automation / src / main / java / org / onap / sdc / ci / tests / datatypes / ResourceReqDetails.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.onap.sdc.ci.tests.datatypes;
22
23 import java.util.List;
24
25 import org.onap.sdc.ci.tests.devObjects.ResourceTypeEnum;
26
27 public class ResourceReqDetails extends ComponentReqDetails {
28         List<String> derivedFrom;
29         String vendorName;
30         String vendorRelease;
31
32         // Unsettable/unupdatable fields
33
34         Boolean isAbstract;
35         Boolean isHighestVersion;
36         String cost;
37         String licenseType;
38         String toscaResourceName;
39
40         private String resourceType = ResourceTypeEnum.VFC.toString(); // Default
41                                                                                                                                         // value
42
43         public ResourceReqDetails() {
44                 super();
45         }
46
47
48         public ResourceReqDetails(String resourceName, String description, List<String> tags, String category,
49                         List<String> derivedFrom, String vendorName, String vendorRelease, String contactId, String icon) {
50                 this(resourceName, description, tags, category, derivedFrom, vendorName, vendorRelease, contactId, icon,
51                                 ResourceTypeEnum.VFC.toString());
52         }
53
54         // new
55         public ResourceReqDetails(String resourceName, String description, List<String> tags, String category,
56                         List<String> derivedFrom, String vendorName, String vendorRelease, String contactId, String icon,
57                         String resourceType) {
58                 super();
59                 this.resourceType = resourceType;
60                 this.name = resourceName;
61                 this.description = description;
62                 this.tags = tags;
63                 // this.category = category;
64                 this.derivedFrom = derivedFrom;
65                 this.vendorName = vendorName;
66                 this.vendorRelease = vendorRelease;
67                 this.contactId = contactId;
68                 this.icon = icon;
69                 if (category != null) {
70                         String[] arr = category.split("/");
71                         if (arr.length == 2) {
72                                 addCategoryChain(arr[0], arr[1]);
73                         }
74                 }
75                 this.toscaResourceName = resourceName;
76         }
77
78         public ResourceReqDetails(ResourceReqDetails originalResource, String version) {
79                 super();
80                 this.name = originalResource.getName();
81                 this.description = originalResource.getDescription();
82                 this.tags = originalResource.getTags();
83                 // this.category = originalResource.getCategory();
84                 this.derivedFrom = originalResource.getDerivedFrom();
85                 this.vendorName = originalResource.getVendorName();
86                 this.vendorRelease = originalResource.getVendorRelease();
87                 this.contactId = originalResource.getContactId();
88                 this.icon = originalResource.getIcon();
89                 this.version = version;
90                 this.uniqueId = originalResource.getUniqueId();
91                 this.categories = originalResource.getCategories();
92                 this.toscaResourceName = originalResource.getToscaResourceName();
93                 this.resourceType = originalResource.getResourceType();
94         }
95
96         public ResourceReqDetails(String resourceName, List<String> derivedFrom, String vendorName, String vendorRelease,
97                         String resourceVersion, Boolean isAbstract, Boolean isHighestVersion, String cost, String licenseType,
98                         String resourceType) {
99                 super();
100                 this.name = resourceName;
101                 this.derivedFrom = derivedFrom;
102                 this.vendorName = vendorName;
103                 this.vendorRelease = vendorRelease;
104                 this.version = resourceVersion;
105                 this.isAbstract = isAbstract;
106                 this.isHighestVersion = isHighestVersion;
107                 this.cost = cost;
108                 this.licenseType = licenseType;
109                 this.resourceType = resourceType;
110                 this.toscaResourceName = resourceName;
111         }
112
113         public String getToscaResourceName() {
114                 return toscaResourceName;
115         }
116
117         public void setToscaResourceName(String toscaResourceName) {
118                 this.toscaResourceName = toscaResourceName;
119         }
120
121         public List<String> getDerivedFrom() {
122                 return derivedFrom;
123         }
124
125         public void setDerivedFrom(List<String> derivedFrom) {
126                 this.derivedFrom = derivedFrom;
127         }
128
129         public String getVendorName() {
130                 return vendorName;
131         }
132
133         public void setVendorName(String vendorName) {
134                 this.vendorName = vendorName;
135         }
136
137         public String getVendorRelease() {
138                 return vendorRelease;
139         }
140
141         public void setVendorRelease(String vendorRelease) {
142                 this.vendorRelease = vendorRelease;
143         }
144
145         public String getCost() {
146                 return cost;
147         }
148
149         public void setCost(String cost) {
150                 this.cost = cost;
151         }
152
153         public String getLicenseType() {
154                 return licenseType;
155         }
156
157         public void setLicenseType(String licenseType) {
158                 this.licenseType = licenseType;
159         }
160
161         // Unupdatable fields - to check that they are not updated
162         public void setIsAbstract(Boolean isAbstract) {
163                 this.isAbstract = isAbstract;
164         }
165
166         public void setIsHighestVersion(Boolean isHighestVersion) {
167                 this.isHighestVersion = isHighestVersion;
168         }
169
170         public Boolean getIsAbstract() {
171                 return isAbstract;
172         }
173
174         public Boolean getIsHighestVersion() {
175                 return isHighestVersion;
176         }
177
178         public String getResourceType() {
179                 return resourceType;
180         }
181
182         public void setResourceType(String resourceType) {
183                 this.resourceType = resourceType;
184         }
185
186         @Override
187         public String toString() {
188                 return "ResourceReqDetails [name=" + name + ", derivedFrom=" + derivedFrom + ", vendorName=" + vendorName
189                                 + ", vendorRelease=" + vendorRelease + ", version=" + version + ", isAbstract=" + isAbstract
190                                 + ", isHighestVersion=" + isHighestVersion + ", cost=" + cost + ", licenseType=" + licenseType
191                                 + ", resourceType=" + resourceType + "]";
192         }
193
194 }