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;
33 // Unsettable/unupdatable fields
36 Boolean isHighestVersion;
39 String toscaResourceName;
41 private String resourceType = ResourceTypeEnum.VFC.toString(); // Default
44 public ResourceReqDetails() {
48 public ResourceReqDetails(Resource resource) {
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();
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());
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) {
85 this.resourceType = resourceType;
86 this.name = resourceName;
87 this.description = description;
89 // this.category = category;
90 this.derivedFrom = derivedFrom;
91 this.vendorName = vendorName;
92 this.vendorRelease = vendorRelease;
93 this.contactId = contactId;
95 if (category != null) {
96 String[] arr = category.split("/");
97 if (arr.length == 2) {
98 addCategoryChain(arr[0], arr[1]);
101 this.toscaResourceName = resourceName;
104 public ResourceReqDetails(ResourceReqDetails originalResource, String version) {
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();
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) {
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;
134 this.licenseType = licenseType;
135 this.resourceType = resourceType;
136 this.toscaResourceName = resourceName;
139 public String getToscaResourceName() {
140 return toscaResourceName;
143 public void setToscaResourceName(String toscaResourceName) {
144 this.toscaResourceName = toscaResourceName;
147 public List<String> getDerivedFrom() {
151 public void setDerivedFrom(List<String> derivedFrom) {
152 this.derivedFrom = derivedFrom;
155 public String getVendorName() {
159 public void setVendorName(String vendorName) {
160 this.vendorName = vendorName;
163 public String getVendorRelease() {
164 return vendorRelease;
167 public void setVendorRelease(String vendorRelease) {
168 this.vendorRelease = vendorRelease;
171 public String getCost() {
175 public void setCost(String cost) {
179 public String getLicenseType() {
183 public void setLicenseType(String licenseType) {
184 this.licenseType = licenseType;
187 // Unupdatable fields - to check that they are not updated
188 public void setIsAbstract(Boolean isAbstract) {
189 this.isAbstract = isAbstract;
192 public void setIsHighestVersion(Boolean isHighestVersion) {
193 this.isHighestVersion = isHighestVersion;
196 public Boolean getIsAbstract() {
200 public Boolean getIsHighestVersion() {
201 return isHighestVersion;
204 public String getResourceType() {
208 public void setResourceType(String resourceType) {
209 this.resourceType = resourceType;
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 + "]";