2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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.vendorsoftwareproduct.dao.impl.zusammen.convertor;
23 import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
24 import com.amdocs.zusammen.adaptor.inbound.api.types.item.ElementInfo;
25 import com.amdocs.zusammen.datatypes.item.Info;
26 import com.amdocs.zusammen.datatypes.item.Item;
27 import org.openecomp.convertor.ElementConvertor;
28 import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.VendorSoftwareProductInfoDaoZusammenImpl;
29 import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
30 import org.openecomp.sdc.versioning.dao.types.Version;
33 public class ElementToVSPGeneralConvertor extends ElementConvertor {
35 public VspDetails convert(Element element) {
36 if (element == null) {
39 return mapInfoToVspDetails(element.getInfo());
44 public VspDetails convert(Item item) {
48 VspDetails vspDetails = mapInfoToVspDetails(item.getInfo());
49 vspDetails.setId(item.getId().getValue());
54 public VspDetails convert(ElementInfo elementInfo) {
55 if (elementInfo == null) {
58 return mapInfoToVspDetails(elementInfo.getInfo());
63 private VspDetails mapInfoToVspDetails(Info info) {
65 VspDetails vspDetails = new VspDetails();
67 vspDetails.setName(info.getProperty(VendorSoftwareProductInfoDaoZusammenImpl
68 .InfoPropertyName.NAME.getValue()));
69 vspDetails.setDescription(info.getProperty(
70 VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.DESCRIPTION.getValue()));
71 vspDetails.setIcon(info.getProperty(
72 VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.ICON.getValue()));
73 vspDetails.setCategory(info.getProperty(
74 VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.CATEGORY.getValue()));
75 vspDetails.setSubCategory(info.getProperty(
76 VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.SUB_CATEGORY.getValue()));
77 vspDetails.setVendorId(info.getProperty(
78 VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.VENDOR_ID.getValue()));
79 vspDetails.setVendorName(info.getProperty(
80 VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.VENDOR_NAME.getValue()));
82 VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.VENDOR_VERSION.getValue()) != null) {
83 vspDetails.setVlmVersion(new Version(info.getProperty(
84 VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.VENDOR_VERSION.getValue())));
87 vspDetails.setLicenseAgreement(info.getProperty(
88 VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.LICENSE_AGREEMENT.getValue()));
89 vspDetails.setFeatureGroups(info.getProperty(
90 VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.FEATURE_GROUPS.getValue()));
91 vspDetails.setOnboardingMethod(info.getProperty(
92 VendorSoftwareProductInfoDaoZusammenImpl.InfoPropertyName.ON_BOARDING_METHOD.getValue()));