Add notifications option to serialized resource node when requested through API.

@DI\Observe("serialize_resource_node")
12557
public function onSerialize(DecorateResourceNodeEvent $event)
    {
        $options = $event->getOptions();

        if (!in_array(Options::SKIP_RESOURCE_NOTIFICATION, $options)) {
            $node = $event->getResourceNode();
            $user = $this->tokenStorage->getToken()->getUser();
            $followResource = $user !== 'anon.' ?
                $this->notificationManager->getFollowerResource(
                    $user->getId(),
                    $node->getId(),
                    $node->getClass()
                ) :
                false;

            $event->add('notifications', ['enabled' => !empty($followResource)]);
        }
    }
427118
protected function addNotification($message)
    {
        $event = new NotificationEvent();
        $event->setMessage($message);
        
        $this
            ->eventDispatcher
            ->dispatch(NotificationEvent::NAME, $event)
        ;
    }
71353
protected void addNode(ClusterNode node,
                         Map<ResourceType, String> resourceInfos) {
    synchronized (node) {
      // 1: primary
      nameToNode.put(node.getName(), node);
      faultManager.addNode(node.getName(), resourceInfos.keySet());
      nameToApps.put(node.getName(), resourceInfos);
      hostsToSessions.put(node, new HashSet<String>());
      clusterManager.getMetrics().restartTaskTracker(1);
      setAliveDeadMetrics();

      // 2: update runnable indices
      for (Map.Entry<ResourceType, RunnableIndices> entry :
          typeToIndices.entrySet()) {
        ResourceType type = entry.getKey();
        if (resourceInfos.containsKey(type)) {
          if (node.checkForGrant(Utilities.getUnitResourceRequest(type),
                                 resourceLimit)) {
            RunnableIndices r = entry.getValue();
            r.addRunnable(node);
          }
        }
      }
    }
  }
1369492
def old_style_notification(notify)
      resources = resource_hash_references(notify)
      resource_type = resources.xpath("symbol[1]/ident/@value").to_s.to_sym
      if resource_type.empty?
        resource_type = resources.xpath("label/@value").to_s.chop.to_sym
      end
      resource_name = resources.xpath('string_add[1][count(../
        descendant::string_add) = 1]/tstring_content/@value').to_s
      resource_name = resources if resource_name.empty?
      { resource_name: resource_name, resource_type: resource_type }
    end
1297415
public function listen()
    {
        $notifications = $this->repository->findSendable()->toArray();

        foreach ($notifications as $notification) {
            $this->listenNotificationsEvents($notification);
        }
    }
977853
def add_resource(self, resource):
        ''''''
        resource.validate()
        self.update(__raw__={
            '$push': {
                'resources': {
                    '$each': [resource.to_mongo()],
                    '$position': 0
                }
            }
        })
        self.reload()
        post_save.send(self.__class__, document=self,
                       resource_added=resource.id)
623641
def process_notification(self, ntf):
        """"""
        p = "/en:notification/" + self.qname(ntf)
        tmpl = self.xsl_template(p)
        ct = self.xsl_calltemplate("container", tmpl)
        self.xsl_withparam("level", "1", ct)
        if ntf.arg == "eventTime":            # local name collision
            self.xsl_withparam("nsid", ntf.i_module.i_modulename + ":", ct)
        self.process_children(ntf, p, 2)
6912
def _notify(self, data):
        """"""
        payload = tlv.decode(
            payload=data.get('payload'),
            content_type=data.get('ct'),
            decode_b64=True
        )
        super(CurrentResourceValue, self)._notify(payload)
        # after one response, close the channel
        self.ensure_stopped()
587319
public function createTopicNotification($title = null, $body = null, $topic = null)
    {
        $notification = new TopicNotification();
        $notification
            ->setTitle($title)
            ->setBody($body)
            ->setTopic($topic);

        return $notification;
    }
1306957
function notify(message) {
	if (Mix.isUsing('notifications')) {
		let contentImage = path.join(__dirname, '../img/sunshine.png');
		notifier.notify({
			title: 'The Extension of Laravel Mix',
			message: message,
			contentImage: contentImage,
			icon: (os.platform() === 'win32' || os.platform() === 'linux') ? contentImage : undefined
		});
	}
}
1098294
def _notify_receiver(self, receiver, params, doc):
        """"""
        verb = VMAP[doc['op']]
        ns = doc['ns']
        notification_id = Id(ns + 'Notification:' + str(ObjectId()) + '@' + params['authority'])
        object_id = Id(ns + ':' + str(doc['o']['_id']) + '@' + params['authority'])
        try:
            getattr(receiver, '_'.join([verb, params['obj_name_plural']]))(notification_id, [object_id])
        except AttributeError:
            pass
        return notification_id
674003
def enable_runtime_notifications(self, resourceids):
        """"""
        idsarr = ""
        for ihcid in resourceids:
            idsarr += "<a:arrayItem>{id}</a:arrayItem>".format(id=ihcid)

        payload = """<enableRuntimeValueNotifications1 xmlns=\"utcs\"
                     xmlns:a=\"http://www.w3.org/2001/XMLSchema\"
                     xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">
                     {arr}
                     </enableRuntimeValueNotifications1>
                     """.format(arr=idsarr)
        xdoc = self.connection.soap_action('/ws/ResourceInteractionService',
                                           'enableRuntimeValueNotifications',
                                           payload)
        if not xdoc:
            return False
        return True
445197
def add_self_service_notification_xml(ssvc)
      return unless @self_service_data_config[:notifications_supported]

      # oldstyle/broken, only sscv notifs
      if @self_service_data_config[:notifications_supported] == :ssvc_only
        ssvc.add_element('notification').text = self_service_notifications_enabled.to_s
        ssvc.add_element('notification_subject').text = self_service_notification_subject if self_service_notification_subject
        ssvc.add_element('notification_message').text = self_service_notification_message if self_service_notification_message
        return
      end

      # newstyle, 'notifications' subset
      notif = ssvc.add_element('notifications')
      notif.add_element('notifications_enabled').text = self_service_notifications_enabled.to_s
      notif.add_element('notification_type').text = NOTIFICATION_TYPES[self_service_notification_type] if self_service_notification_type
      notif.add_element('notification_subject').text = self_service_notification_subject if self_service_notification_subject
      notif.add_element('notification_message').text = self_service_notification_message if self_service_notification_message

      return unless @self_service_data_config[:notification_reminders]

      reminds = notif.add_element('reminders')
      reminds.add_element('notification_reminders_enabled').text = self_service_reminders_enabled.to_s
      reminds.add_element('notification_reminder_frequency').text = self_service_reminder_frequency.to_s if self_service_reminder_frequency

    end
104005
def new_style_notification(notify)
      # Given `notifies :restart, "service[foo]"` the target is the
      # `"service[foo]"` string portion.
      target_path = 'args_add_block/args_add/descendant::
        tstring_content[count(ancestor::dyna_symbol) = 0]/@value'
      target = notify.xpath("arg_paren/#{target_path} | #{target_path}").to_s

      # Test the target string against the standard syntax for a new-style
      # notification: `resource_type[resource_name]`.
      match = target.match(/^([^\[]+)\[(.*)\]$/)
      return nil unless match

      # Convert the captured resource type and name to symbols.
      resource_type, resource_name =
        match.captures.tap { |m| m[0] = m[0].to_sym }

      # Normally the `resource_name` will be a simple string. However in the
      # case where it has an embedded sub-expression then we will return the
      # AST to the caller to handle.
      if notify.xpath("descendant::string_embexpr").empty?
        return nil if resource_name.empty?
      else
        resource_name =
          notify.xpath("args_add_block/args_add/string_literal")
      end
      { resource_name: resource_name, resource_type: resource_type }
    end
920487
public function addNotifiableNotification(NotifiableNotification $notifiableNotification)
    {
        if (!$this->notifiableNotifications->contains($notifiableNotification)) {
            $this->notifiableNotifications[] = $notifiableNotification;
            $notifiableNotification->setNotifiableEntity($this);
        }

        return $this;
    }
510294
public function addNotification($notification)
    {
        $this->_mixer->getRepository()
        ->registerCallback('before.update', array($this, 'resetStats'), array($this->_mixer));

        $this->_mixer->getRepository()
        ->registerCallback('before.update', array($this, 'removeOldNotifications'), array($this->_mixer));

        $ids = clone $this->notificationIds;
        $ids[] = $notification->id;
        $this->set('notificationIds', $ids);

        $ids = clone $this->newNotificationIds;
        $ids[] = $notification->id;
        $this->set('newNotificationIds', $ids);
    }
723138
public function notify() : ResponseHelper {
        $this->notified = true;

        app('antares.messages')->add($this->type, $this->message);

        return $this;
    }