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