2 * ============LICENSE_START=======================================================
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
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.openecomp.sdc.ci.tests.datatypes;
23 import java.util.List;
25 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
26 import org.openecomp.sdc.be.model.Resource;
28 public class ResourceReqDetails extends ComponentReqDetails {
29 List<String> derivedFrom;
32 String resourceVendorModelNumber;
34 // Unsettable/unupdatable fields
37 Boolean isHighestVersion;
40 String toscaResourceName;
42 private String resourceType = ResourceTypeEnum.VFC.toString(); // Default
45 public ResourceReqDetails() {
49 public ResourceReqDetails(Resource resource) {
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();
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());
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) {
87 this.resourceType = resourceType;
88 this.name = resourceName;
89 this.description = description;
91 // this.category = category;
92 this.derivedFrom = derivedFrom;
93 this.vendorName = vendorName;
94 this.vendorRelease = vendorRelease;
95 this.contactId = contactId;
97 if (category != null) {
98 String[] arr = category.split("/");
99 if (arr.length == 2) {
100 addCategoryChain(arr[0], arr[1]);
103 this.toscaResourceName = resourceName;
106 public ResourceReqDetails(ResourceReqDetails originalResource, String version) {
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();
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) {
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;
136 this.licenseType = licenseType;
137 this.resourceType = resourceType;
138 this.toscaResourceName = resourceName;
141 public String getToscaResourceName() {
142 return toscaResourceName;
145 public void setToscaResourceName(String toscaResourceName) {
146 this.toscaResourceName = toscaResourceName;
149 public List<String> getDerivedFrom() {
153 public void setDerivedFrom(List<String> derivedFrom) {
154 this.derivedFrom = derivedFrom;
157 public String getVendorName() {
161 public void setVendorName(String vendorName) {
162 this.vendorName = vendorName;
165 public String getVendorRelease() {
166 return vendorRelease;
169 public void setVendorRelease(String vendorRelease) {
170 this.vendorRelease = vendorRelease;
173 public String getCost() {
177 public void setCost(String cost) {
181 public String getLicenseType() {
185 public void setLicenseType(String licenseType) {
186 this.licenseType = licenseType;
189 // Unupdatable fields - to check that they are not updated
190 public void setIsAbstract(Boolean isAbstract) {
191 this.isAbstract = isAbstract;
194 public void setIsHighestVersion(Boolean isHighestVersion) {
195 this.isHighestVersion = isHighestVersion;
198 public Boolean getIsAbstract() {
202 public Boolean getIsHighestVersion() {
203 return isHighestVersion;
206 public String getResourceType() {
210 public void setResourceType(String resourceType) {
211 this.resourceType = resourceType;
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 + "]";