2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2024 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.cps.ncmp.api.impl.events.cmsubscription;
23 import java.util.List;
25 import lombok.RequiredArgsConstructor;
26 import org.onap.cps.ncmp.api.impl.events.cmsubscription.mapper.CmNotificationSubscriptionDmiInEventMapper;
27 import org.onap.cps.ncmp.api.impl.events.cmsubscription.mapper.CmNotificationSubscriptionNcmpOutEventMapper;
28 import org.onap.cps.ncmp.api.impl.events.cmsubscription.model.DmiCmNotificationSubscriptionDetails;
29 import org.onap.cps.ncmp.api.impl.events.cmsubscription.model.DmiCmNotificationSubscriptionPredicate;
30 import org.onap.cps.ncmp.events.cmnotificationsubscription_merge1_0_0.ncmp_to_dmi.CmNotificationSubscriptionDmiInEvent;
31 import org.onap.cps.ncmp.events.cmsubscription_merge1_0_0.ncmp_to_client.CmNotificationSubscriptionNcmpOutEvent;
32 import org.springframework.stereotype.Component;
35 @RequiredArgsConstructor
36 public class CmNotificationSubscriptionMappersHandler {
38 private final CmNotificationSubscriptionDmiInEventMapper cmNotificationSubscriptionDmiInEventMapper;
39 private final CmNotificationSubscriptionNcmpOutEventMapper cmNotificationSubscriptionNcmpOutEventMapper;
42 * Mapper to form a request for the DMI Plugin for the Cm Notification Subscription.
44 * @param dmiCmNotificationSubscriptionPredicates Collection of Cm Notification Subscription predicates
45 * @return cm notification subscription dmi in event
47 public CmNotificationSubscriptionDmiInEvent toCmNotificationSubscriptionDmiInEvent(
48 final List<DmiCmNotificationSubscriptionPredicate> dmiCmNotificationSubscriptionPredicates) {
49 return cmNotificationSubscriptionDmiInEventMapper.toCmNotificationSubscriptionDmiInEvent(
50 dmiCmNotificationSubscriptionPredicates);
54 * Mapper to form a response for the client for the Cm Notification Subscription.
56 * @param subscriptionId Cm Notification Subscription id
57 * @param dmiCmNotificationSubscriptionDetailsMap contains CmNotificationSubscriptionDetails per dmi plugin
58 * @return CmNotificationSubscriptionNcmpOutEvent to sent back to the client
60 public CmNotificationSubscriptionNcmpOutEvent toCmNotificationSubscriptionNcmpOutEvent(final String subscriptionId,
61 final Map<String, DmiCmNotificationSubscriptionDetails> dmiCmNotificationSubscriptionDetailsMap) {
62 return cmNotificationSubscriptionNcmpOutEventMapper.toCmNotificationSubscriptionNcmpOutEvent(subscriptionId,
63 dmiCmNotificationSubscriptionDetailsMap);
67 * Mapper to form a rejected response for the client for the Cm Notification Subscription Request.
69 * @param subscriptionId subscription id
70 * @param rejectedTargetFilters list of rejected target filters for the subscription request
71 * @return to sent back to the client
73 public CmNotificationSubscriptionNcmpOutEvent toCmNotificationSubscriptionNcmpOutEventForRejectedRequest(
74 final String subscriptionId, final List<String> rejectedTargetFilters) {
75 return cmNotificationSubscriptionNcmpOutEventMapper.toCmNotificationSubscriptionNcmpOutEventForRejectedRequest(
76 subscriptionId, rejectedTargetFilters);