2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2020 Nordix Foundation.
4 * ================================================================================
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 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.so.adapters.etsisol003adapter.pkgm.converters.etsicatalog.sol003;
23 import static org.slf4j.LoggerFactory.getLogger;
24 import org.onap.so.adapters.etsi.sol003.adapter.common.VnfmAdapterUrlProvider;
25 import org.onap.so.adapters.etsisol003adapter.etsicatalog.notification.model.PkgOnboardingNotification;
26 import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm.notification.model.VnfPackageOnboardingNotification;
27 import org.slf4j.Logger;
28 import org.springframework.core.convert.converter.Converter;
29 import org.springframework.stereotype.Service;
32 * Converter to convert from an Etsi Catalog Manager {@link PkgOnboardingNotification} Object to its equivalent SOL003
33 * {@link VnfPackageOnboardingNotification} Object
35 * @author andrew.a.lamb@est.tech
38 public class PkgOnboardingNotificationConverter extends AbstractPkgNotificationConverter
39 implements Converter<PkgOnboardingNotification, VnfPackageOnboardingNotification> {
40 private static final Logger logger = getLogger(PkgOnboardingNotificationConverter.class);
42 public PkgOnboardingNotificationConverter(final VnfmAdapterUrlProvider vnfmAdapterUrlProvider) {
43 super(vnfmAdapterUrlProvider);
48 * Convert a {@link PkgOnboardingNotification} Object to an {@link VnfPackageOnboardingNotification} Object
50 * @param pkgOnboardingNotification The PkgOnboardingNotification Object to Convert
51 * @return The Converted VnfPackageOnboardingNotification Object
54 public VnfPackageOnboardingNotification convert(final PkgOnboardingNotification pkgOnboardingNotification) {
55 logger.info("Converting PkgChangeNotification\n{}", pkgOnboardingNotification.toString());
56 final VnfPackageOnboardingNotification vnfPackageOnboardingNotification =
57 new VnfPackageOnboardingNotification();
58 vnfPackageOnboardingNotification.setId(pkgOnboardingNotification.getId());
60 if (pkgOnboardingNotification.getNotificationType() != null) {
61 vnfPackageOnboardingNotification.setNotificationType(VnfPackageOnboardingNotification.NotificationTypeEnum
62 .fromValue(pkgOnboardingNotification.getNotificationType().getValue()));
65 vnfPackageOnboardingNotification.setSubscriptionId(pkgOnboardingNotification.getSubscriptionId());
66 vnfPackageOnboardingNotification.setTimeStamp(pkgOnboardingNotification.getTimeStamp());
67 vnfPackageOnboardingNotification.setVnfPkgId(pkgOnboardingNotification.getVnfPkgId());
68 vnfPackageOnboardingNotification.setVnfdId(pkgOnboardingNotification.getVnfdId());
70 vnfPackageOnboardingNotification.setLinks(convert(pkgOnboardingNotification.getLinks(),
71 pkgOnboardingNotification.getVnfPkgId(), pkgOnboardingNotification.getSubscriptionId()));
73 return vnfPackageOnboardingNotification;