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