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.etsi.sol003.adapter.packagemanagement.converters.etsicatalog.sol003;
23 import static org.slf4j.LoggerFactory.getLogger;
24 import org.onap.so.adapters.etsi.sol003.adapter.etsicatalog.notification.model.PkgOnboardingNotification;
25 import org.onap.so.adapters.etsi.sol003.adapter.packagemanagement.extclients.vnfm.notification.model.VnfPackageOnboardingNotification;
26 import org.slf4j.Logger;
27 import org.springframework.core.convert.converter.Converter;
28 import org.springframework.stereotype.Service;
31 * Converter to convert from an Etsi Catalog Manager {@link PkgOnboardingNotification} Object to its equivalent SOL003
32 * {@link VnfPackageOnboardingNotification} Object
34 * @author andrew.a.lamb@est.tech
37 public class PkgOnboardingNotificationConverter extends AbstractPkgNotificationConverter
38 implements Converter<PkgOnboardingNotification, VnfPackageOnboardingNotification> {
39 private static final Logger logger = getLogger(PkgOnboardingNotificationConverter.class);
42 * Convert a {@link PkgOnboardingNotification} Object to an {@link VnfPackageOnboardingNotification} Object
44 * @param pkgOnboardingNotification The PkgOnboardingNotification Object to Convert
45 * @return The Converted VnfPackageOnboardingNotification Object
48 public VnfPackageOnboardingNotification convert(final PkgOnboardingNotification pkgOnboardingNotification) {
49 logger.info("Converting PkgChangeNotification\n{}", pkgOnboardingNotification.toString());
50 final VnfPackageOnboardingNotification vnfPackageOnboardingNotification =
51 new VnfPackageOnboardingNotification();
52 vnfPackageOnboardingNotification.setId(pkgOnboardingNotification.getId());
54 if (pkgOnboardingNotification.getNotificationType() != null) {
55 vnfPackageOnboardingNotification.setNotificationType(VnfPackageOnboardingNotification.NotificationTypeEnum
56 .fromValue(pkgOnboardingNotification.getNotificationType().getValue()));
59 vnfPackageOnboardingNotification.setSubscriptionId(pkgOnboardingNotification.getSubscriptionId());
60 vnfPackageOnboardingNotification.setTimeStamp(pkgOnboardingNotification.getTimeStamp());
61 vnfPackageOnboardingNotification.setVnfPkgId(pkgOnboardingNotification.getVnfPkgId());
62 vnfPackageOnboardingNotification.setVnfdId(pkgOnboardingNotification.getVnfdId());
64 vnfPackageOnboardingNotification.setLinks(convert((pkgOnboardingNotification.getLinks())));
66 return vnfPackageOnboardingNotification;