Add collaboration feature
[sdc.git] / openecomp-be / lib / openecomp-sdc-notification-lib / openecomp-sdc-notification-core / src / main / java / org / openecomp / sdc / notification / services / impl / NotificationPropagationManagerImpl.java
1 package org.openecomp.sdc.notification.services.impl;
2
3 import org.openecomp.sdc.destinationprovider.impl.MulticastDestination;
4 import org.openecomp.sdc.destinationprovider.impl.UnicastDestination;
5 import org.openecomp.sdc.notification.dtos.Event;
6 import org.openecomp.sdc.notification.services.NotificationPropagationManager;
7 import org.openecomp.sdc.notification.services.PropagationService;
8 import org.openecomp.sdc.notification.services.SubscriptionService;
9
10 /**
11  * @author avrahamg
12  * @since July 10, 2017
13  */
14 public class NotificationPropagationManagerImpl implements NotificationPropagationManager {
15
16     private PropagationService propagationService;
17     private SubscriptionService subscriptionService;
18
19     public NotificationPropagationManagerImpl(PropagationService propagationService,
20                                               SubscriptionService subscriptionService) {
21         this.propagationService = propagationService;
22         this.subscriptionService = subscriptionService;
23     }
24
25     @Override
26     public void notifySubscribers(Event event, String ... excludedSubscribers) {
27         propagationService.notify(event, new MulticastDestination(event.getEntityId(),
28             subscriptionService, excludedSubscribers));
29     }
30
31     @Override
32     public void directNotification(Event event, String destinationId) {
33         propagationService.notify(event, new UnicastDestination(destinationId));
34     }
35 }