test_class.declarator: TEST_CID = 0
test_class.modifier: private static final
test_class.original_string: private static final long TEST_CID = 0;
test_class.type: long
test_class.var_name: TEST_CID
test_class.declarator: dispatcher
test_class.modifier: private
test_class.original_string: private Dispatcher dispatcher;
test_class.type: Dispatcher
test_class.var_name: dispatcher
test_class.declarator: cmProcessor
test_class.modifier: private
test_class.original_string: private CmsCmProcessor cmProcessor;
test_class.type: CmsCmProcessor
test_class.var_name: cmProcessor
test_class.declarator: subService
test_class.modifier: private
test_class.original_string: private SubscriberService subService;
test_class.type: SubscriberService
test_class.var_name: subService
test_class.file: antenna/src/test/java/com/oneops/antenna/service/DispatcherTest.java
test_class.identifier: DispatcherTest
test_case.body: @Test
      public void testDispatch() {
  
          NotificationMessage notificationMessage = new NotificationMessage();
          notificationMessage.setNsPath("/a/b");
          notificationMessage.setType(NotificationType.ci); //deployment procedure and OTHER
          notificationMessage.setCmsId(TEST_CID);
          this.dispatcher.dispatch(notificationMessage);
      }
test_case.class_method_signature: DispatcherTest.testDispatch()
test_case.full_signature: @Test public void testDispatch()
test_case.identifier: testDispatch
test_case.invocations: setNsPath setType setCmsId dispatch
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDispatch()
focal_class.declarator: logger = Logger.getLogger(Dispatcher.class)
focal_class.modifier: private static
focal_class.original_string: private static Logger logger = Logger.getLogger(Dispatcher.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: gson
focal_class.modifier: private final
focal_class.original_string: private final Gson gson;
focal_class.type: Gson
focal_class.var_name: gson
focal_class.declarator: sbrService
focal_class.modifier: private final
focal_class.original_string: private final SubscriberService sbrService;
focal_class.type: SubscriberService
focal_class.var_name: sbrService
focal_class.declarator: eSender
focal_class.modifier: private final
focal_class.original_string: private final NotificationSender eSender;
focal_class.type: NotificationSender
focal_class.var_name: eSender
focal_class.declarator: snsSender
focal_class.modifier: private final
focal_class.original_string: private final NotificationSender snsSender;
focal_class.type: NotificationSender
focal_class.var_name: snsSender
focal_class.declarator: urlSender
focal_class.modifier: private final
focal_class.original_string: private final NotificationSender urlSender;
focal_class.type: NotificationSender
focal_class.var_name: urlSender
focal_class.declarator: xmppSender
focal_class.modifier: private final
focal_class.original_string: private final NotificationSender xmppSender;
focal_class.type: NotificationSender
focal_class.var_name: xmppSender
focal_class.declarator: slackSender
focal_class.modifier: private final
focal_class.original_string: private final NotificationSender slackSender;
focal_class.type: NotificationSender
focal_class.var_name: slackSender
focal_class.declarator: cmProcessor
focal_class.modifier: private final
focal_class.original_string: private final CmsCmProcessor cmProcessor;
focal_class.type: CmsCmProcessor
focal_class.var_name: cmProcessor
focal_class.declarator: dpmtProcessor
focal_class.modifier: private final
focal_class.original_string: private final CmsDpmtProcessor dpmtProcessor;
focal_class.type: CmsDpmtProcessor
focal_class.var_name: dpmtProcessor
focal_class.declarator: procProcessor
focal_class.modifier: private final
focal_class.original_string: private final OpsProcedureProcessor procProcessor;
focal_class.type: OpsProcedureProcessor
focal_class.var_name: procProcessor
focal_class.declarator: cmsUtil
focal_class.modifier: private final
focal_class.original_string: private final CmsUtil cmsUtil;
focal_class.type: CmsUtil
focal_class.var_name: cmsUtil
focal_class.declarator: dpmtMapper
focal_class.modifier: private
focal_class.original_string: private DJDpmtMapper dpmtMapper;
focal_class.type: DJDpmtMapper
focal_class.var_name: dpmtMapper
focal_class.declarator: cmsMdProcessor
focal_class.modifier: private
focal_class.original_string: private CmsMdProcessor cmsMdProcessor;
focal_class.type: CmsMdProcessor
focal_class.var_name: cmsMdProcessor
focal_class.file: antenna/src/main/java/com/oneops/antenna/service/Dispatcher.java
focal_class.identifier: Dispatcher
focal_class.class_method_signature: Dispatcher.Dispatcher(Gson gson,
                        SubscriberService sbrService,
                        NotificationSender eSender,
                        NotificationSender snsSender,
                        NotificationSender urlSender,
                        NotificationSender xmppSender,
                        NotificationSender slackSender,
                        CmsCmProcessor cmProcessor,
                        CmsDpmtProcessor dpmtProcessor,
                        OpsProcedureProcessor procProcessor,
          DJDpmtMapper dpmtMapper,
          CmsMdProcessor mdProcessor,
          CmsUtil cmsUtil)
focal_class.full_signature: @Autowired public  Dispatcher(Gson gson,
                        SubscriberService sbrService,
                        NotificationSender eSender,
                        NotificationSender snsSender,
                        NotificationSender urlSender,
                        NotificationSender xmppSender,
                        NotificationSender slackSender,
                        CmsCmProcessor cmProcessor,
                        CmsDpmtProcessor dpmtProcessor,
                        OpsProcedureProcessor procProcessor,
          DJDpmtMapper dpmtMapper,
          CmsMdProcessor mdProcessor,
          CmsUtil cmsUtil)
focal_class.identifier: Dispatcher
focal_class.modifiers: @Autowired public
focal_class.parameters: (Gson gson,
                        SubscriberService sbrService,
                        NotificationSender eSender,
                        NotificationSender snsSender,
                        NotificationSender urlSender,
                        NotificationSender xmppSender,
                        NotificationSender slackSender,
                        CmsCmProcessor cmProcessor,
                        CmsDpmtProcessor dpmtProcessor,
                        OpsProcedureProcessor procProcessor,
          DJDpmtMapper dpmtMapper,
          CmsMdProcessor mdProcessor,
          CmsUtil cmsUtil)
focal_class.signature:  Dispatcher(Gson gson,
                        SubscriberService sbrService,
                        NotificationSender eSender,
                        NotificationSender snsSender,
                        NotificationSender urlSender,
                        NotificationSender xmppSender,
                        NotificationSender slackSender,
                        CmsCmProcessor cmProcessor,
                        CmsDpmtProcessor dpmtProcessor,
                        OpsProcedureProcessor procProcessor,
          DJDpmtMapper dpmtMapper,
          CmsMdProcessor mdProcessor,
          CmsUtil cmsUtil)
focal_class.class_method_signature: Dispatcher.dispatch(NotificationMessage msg)
focal_class.full_signature: public void dispatch(NotificationMessage msg)
focal_class.identifier: dispatch
focal_class.modifiers: public
focal_class.parameters: (NotificationMessage msg)
focal_class.return: void
focal_class.signature: void dispatch(NotificationMessage msg)
focal_class.class_method_signature: Dispatcher.getNsPath(NotificationMessage msg)
focal_class.full_signature: private String getNsPath(NotificationMessage msg)
focal_class.identifier: getNsPath
focal_class.modifiers: private
focal_class.parameters: (NotificationMessage msg)
focal_class.return: String
focal_class.signature: String getNsPath(NotificationMessage msg)
focal_class.class_method_signature: Dispatcher.getNsPathForCi(long ciId)
focal_class.full_signature: private String getNsPathForCi(long ciId)
focal_class.identifier: getNsPathForCi
focal_class.modifiers: private
focal_class.parameters: (long ciId)
focal_class.return: String
focal_class.signature: String getNsPathForCi(long ciId)
focal_class.class_method_signature: Dispatcher.getNsPathForDpmt(long dpmtId)
focal_class.full_signature: private String getNsPathForDpmt(long dpmtId)
focal_class.identifier: getNsPathForDpmt
focal_class.modifiers: private
focal_class.parameters: (long dpmtId)
focal_class.return: String
focal_class.signature: String getNsPathForDpmt(long dpmtId)
focal_class.class_method_signature: Dispatcher.getNsPathForProc(long procId)
focal_class.full_signature: private String getNsPathForProc(long procId)
focal_class.identifier: getNsPathForProc
focal_class.modifiers: private
focal_class.parameters: (long procId)
focal_class.return: String
focal_class.signature: String getNsPathForProc(long procId)
focal_method.body: public void dispatch(NotificationMessage msg) {
          if (msg.getNsPath() == null) {
              String nsPath = getNsPath(msg);
              if (nsPath != null) {
                  msg.setNsPath(nsPath);
              } else {
                  logger.error("Can not figure out nsPath for msg " + gson.toJson(msg));
                  return;
              }
          }
  
          List<BasicSubscriber> subscribers = sbrService.getSubscribersForNs(msg.getNsPath());
          try {
              for (BasicSubscriber sub : subscribers) {
                  NotificationMessage nMsg = msg;
  
                  if (sub.hasFilter() && !sub.getFilter().accept(nMsg)) {
                      continue;
                  }
                  if (sub.hasTransformer()) {
                      nMsg = sub.getTransformer().transform(nMsg);
                  }
                  if (sub instanceof EmailSubscriber) {
                      eSender.postMessage(nMsg, sub);
                  } else if (sub instanceof SNSSubscriber) {
                      snsSender.postMessage(nMsg, sub);
                  } else if (sub instanceof URLSubscriber) {
                    if (sub.getFilter() instanceof NotificationFilter) {
                      NotificationFilter nFilter = NotificationFilter.class.cast(sub.getFilter());
                      if (nFilter.isIncludeCi() && ArrayUtils.isNotEmpty(nFilter.getClassNames())) {
                        final List<Long> ciIds = dpmtMapper
                            .getDeploymentRfcCIs(msg.getCmsId(), null, null, nFilter.getClassNames(),
                                nFilter.getActions())
                            .stream()
                            .map(rfc -> rfc.getCiId())
                            .collect(Collectors.toList());
                        if(ciIds.isEmpty()){
                          // There are no ci's which sink is subscribed to , skip notifications.
                          continue;
                        }
                        final List<CmsCISimple> cis = cmProcessor.getCiByIdList(ciIds).stream()
                            .map(ci -> cmsUtil.custCI2CISimple(ci, "df")).collect(
                                Collectors.toList());
                        nMsg.setCis(cis);
                      }
                    }
                    if(logger.isDebugEnabled()){
                      logger.debug("nMsg " + gson.toJson(nMsg));
                    }
                    urlSender.postMessage(nMsg, sub);
                  } else if (sub instanceof XMPPSubscriber) {
                      xmppSender.postMessage(nMsg, sub);
                  } else if (sub instanceof SlackSubscriber) {
                      slackSender.postMessage(nMsg, sub);
                  }
              }
          } catch (Exception e) {
              logger.error("Message dispatching failed.", e);
          }
      }
focal_method.class_method_signature: Dispatcher.dispatch(NotificationMessage msg)
focal_method.full_signature: public void dispatch(NotificationMessage msg)
focal_method.identifier: dispatch
focal_method.invocations: getNsPath getNsPath setNsPath error toJson getSubscribersForNs getNsPath hasFilter accept getFilter hasTransformer transform getTransformer postMessage postMessage getFilter cast getFilter isIncludeCi isNotEmpty getClassNames collect map stream getDeploymentRfcCIs getCmsId getClassNames getActions getCiId toList isEmpty collect map stream getCiByIdList custCI2CISimple toList setCis isDebugEnabled debug toJson postMessage postMessage postMessage error
focal_method.modifiers: public
focal_method.parameters: (NotificationMessage msg)
focal_method.return: void
focal_method.signature: void dispatch(NotificationMessage msg)