2 * Copyright © 2016-2018 European Support Limited
3 * Modifications Copyright (C) 2021 Nordix Foundation.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 package org.openecomp.sdcrests.vendorsoftwareproducts.types;
19 import java.util.ArrayList;
20 import java.util.Collections;
21 import java.util.List;
22 import java.util.stream.Collectors;
23 import javax.validation.constraints.NotNull;
25 import lombok.EqualsAndHashCode;
26 import lombok.ToString;
27 import org.apache.commons.collections.CollectionUtils;
28 import org.openecomp.sdc.common.util.ValidationUtils;
29 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.LicenseType;
30 import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData;
35 public class VspDescriptionDto {
40 private String description;
43 private String category;
45 private String subCategory;
47 private String vendorName;
49 private String vendorId; // this will be populated with vlm id
50 private String licensingVersion; // this will be populated with vlm version
51 private LicenseType licenseType;
52 private LicensingData licensingData;
53 private List<String> selectedModelList;
55 public void setName(final String name) {
56 this.name = ValidationUtils.sanitizeInputString(name);
59 public void setVendorName(final String vendorName) {
60 this.vendorName = ValidationUtils.sanitizeInputString(vendorName);
63 public void setDescription(final String description) {
64 this.description = ValidationUtils.sanitizeInputString(description);
67 public void setSelectedModelList(final List<String> selectedModelList) {
68 if (CollectionUtils.isEmpty(selectedModelList)) {
69 this.selectedModelList = new ArrayList<>();
72 this.selectedModelList = selectedModelList.stream().map(ValidationUtils::sanitizeInputString).collect(Collectors.toList());
75 public List<String> getSelectedModelList() {
76 if (selectedModelList == null) {
77 return Collections.emptyList();
79 return new ArrayList<>(selectedModelList);