Function To Notify Core Platform That The Submission Is Complete. The core platform will send a mail to any subscribers.
@param req
@param res
@param next
549961
function notifySubmissionComplete(req, res, next){
  req.appformsResultPayload = req.appformsResultPayload || {};
  var completeStatus = req.appformsResultPayload.data;
  var submission = completeStatus.formSubmission;

  //The Submission Is Not Complete, No need to send a notification.
  if("complete" !== completeStatus.status){
    return next();
  }

  var resourcePath = "/api/v2/appforms/domain/:domain/projects/:projectid/apps/:guid/forms/" + submission.formId + "/submissions/" + req.params.id + "/complete";

  var params = _createRequestParams(_.extend({
    resourcePath: resourcePath,
    method: "POST",
    apiKey: req.get('x-fh-auth-app'),
    appMbaasModel: req.appMbaasModel,
    data: completeStatus
  }, req.params));

  log.logger.debug("notifySubmissionComplete ", {params: params});

  request(params, _createResponseHandler(req, next, true));
}
1152295
function(req, res) {
        if (req.headers.accept == 'application/json') {
            res.header('Content-Type', 'application/json');
            res.status(200).json({
                data: {
                    ontologyTxt: req.rawOntology,
                    mimeType: req.mimeType
                },
                requestDelay: req.requestDelay,
                serverTime: new Date().getTime()
            });
        } else {
            res.header('Content-Type', req.mimeType);
            res.status(200).send(req.rawOntology);
        }
    }
496625
function listSubscribers(req, res, next) {
  var listSubscribersParams = {
    _id: req.params.id
  };

  logger.debug("Middleware: listSubscribers: ", {params: listSubscribersParams});

  forms.getNotifications(_.extend(req.connectionOptions, listSubscribersParams), formsResultHandlers(constants.resultTypes.forms, req, next));
}
1261650
function get(req, res, next) {
  var params = {
    _id: req.params.id
  };

  logger.debug("Middleware Submissions Get ", {params: params});

  forms.getSubmission(req.connectionOptions, params, submissionsHandler(constants.resultTypes.submissions, req, next));
}
699923
@SuppressWarnings({"UnusedDeclaration"})
    public void doSubmit(StaplerRequest req, StaplerResponse resp) throws IOException, ServletException {
        getACL().checkPermission(getPermission());

        bindParameters(req);
        // current user is bound to the thread and will be lost in the perform method
        User user = User.current();
        String ciUser = (user == null) ? "anonymous" : user.getId();

        JSONObject formData = req.getSubmittedForm();
        if (formData.has("promotionPlugin")) {
            JSONObject pluginSettings = formData.getJSONObject("promotionPlugin");
            if (pluginSettings.has("pluginName")) {
                String pluginName = pluginSettings.getString("pluginName");
                if (!UserPluginInfo.NO_PLUGIN_KEY.equals(pluginName)) {
                    PluginSettings settings = new PluginSettings();
                    Map<String, String> paramMap = Maps.newHashMap();
                    settings.setPluginName(pluginName);
                    Map<String, Object> filteredPluginSettings = Maps.filterKeys(pluginSettings,
                            new Predicate<String>() {
                                public boolean apply(String input) {
                                    return StringUtils.isNotBlank(input) && !"pluginName".equals(input);
                                }
                            });
                    for (Map.Entry<String, Object> settingsEntry : filteredPluginSettings.entrySet()) {
                        String key = settingsEntry.getKey();
                        paramMap.put(key, pluginSettings.getString(key));
                    }
                    paramMap.put("ciUser", ciUser);
                    if (!paramMap.isEmpty()) {
                        settings.setParamMap(paramMap);
                    }
                    setPromotionPlugin(settings);
                }
            }
        }

        final BuildInfoAwareConfigurator configurator = getCurrentConfigurator();
        ArtifactoryServer server = configurator.getArtifactoryServer();

        new PromoteWorkerThread(server, CredentialManager.getPreferredDeployer((DeployerOverrider) configurator, server), ciUser).start();

        resp.sendRedirect(".");
    }
17542
function handleNotifyNext(e) {
  if (notifyOfNextSubs[e.type].length === 0) return;
  e.persist = blankFunction;
  const reNotifyOfNext = [];
  const reNotifyOfNextIDs = {};
  notifyOfNextSubs[e.type].forEach(sub => {
    if (sub.callback(e) === 'reNotifyOfNext') {
      reNotifyOfNextIDs[sub.id] = reNotifyOfNext.push(sub) - 1;
    }
  });
  notifyOfNextSubs[e.type] = reNotifyOfNext;
  subsIDs[e.type] = reNotifyOfNextIDs;
}
591955
public void notifyUpdate( URL resource, int expected, int count )
    {
        if( m_first )
        {
            m_expected = expected;
            m_start = System.currentTimeMillis();
            m_first = false;
        }
        int completed = ( count * 100 ) / expected;
        m_out.print( resource.toExternalForm() + " : " + completed + "%    \r" );
    }
745003
function(req, res, next) {
			res.set('XX-Powered-By', 'Restpress');
			req.resource = self;
			req.actionName = actionName;
			req.action = action;
			next();
		}
588208
function notify(api) {
  api = createApi(api);
  reactApis.push(api);
  subsciptions.forEach(function(fn) {
    fn(api);
  });
}
620630
function serviceCall(req, res, next) {
        Q(pushService.registerPushDevice(req.body)).then(res.json.bind(res), next).done();
    }
948110
public void notifyCompletion( URL resource )
    {
        long now = System.currentTimeMillis();
        long time = now - m_start;
        int kBps = (int) ( m_expected / time );
        m_out.println( resource.toExternalForm() + " : " + kBps + " kBps.          " );
    }
618030
function confirmTransmit(outpacket, err) {
  if (this.active && err) {
    // Roll it all back into outbox (which may not be empty anymore)
    if (outpacket.responses.length > 0) {
      Array.prototype.push.apply(this.outbox.responses, outpacket.responses);
    }
    if (outpacket.requests.length > 0) {
      Array.prototype.push.apply(this.outbox.requests, outpacket.requests);
    }
  }
}
867482
public void afterCompletion(int status) {
        for (DeferredEventNotification<?> notification : notifications) {
            if (!notification.isBefore() && notification.getStatus().matches(status)) {
                notification.run();
            }
        }
    }
1303500
function handler(req, res, next) {
    next = next || send

    if (pending) return pending.once('ready', function(err) {
      if (err) return next(err)
      return handler(req, res, next)
    })

    if (prevError) return next(prevError)

    res.setHeader('content-type', 'text/css')
    return next(null, buffer)

    function send(err, body) {
      if (err) return res.emit(err)
      res.end(body)
    }
  }
1139147
@Override
    public void onSubscribe(Subscription subscription) {
        this.subscription = subscription;
        if (cancelled) {
            subscription.cancel();
            return;
        }
        if (deferredInitialMessageRequest > 0) {
            request(deferredInitialMessageRequest);
        }
    }
880368
function(req, res, next) {
        var initialTime = 0,
            receivedReqTime = new Date().getTime();

        req.requestDelay =  receivedReqTime - initialTime;
        var url = req.body.url;

        request.get(url, function (error, response, body) {
            if (!error && response.statusCode == 200) {
                req.rawOntology = body.toString().replace(/(&)([a-z0-9]+)(;)/gi, '$2:');
                next();
            }
        });
    }
42706
function update(req, res, next) {
  var body = req.body;

  db.posts.update(req.params.post, body, function(err, post) {
    if(err) { return next(err); }

    res.json(201, post);
    signals.emit('post:update', post);
  });
}