<commit_before>// Copyright 2017, EMC, Inc

'use strict';

var di = require('di');

module.exports = RestJobFactory;
di.annotate(RestJobFactory, new di.Provide('Job.Redfish.Alert.Enable'));

di.annotate(RestJobFactory, new di.Inject(
    'Job.Base',
    'Logger',
    '_',
    'Assert',
    'Promise',
    'Util',
    'HttpTool',
    'Services.Waterline',
    'Services.Configuration'));


function RestJobFactory(BaseJob,
                        Logger,
                        _,
                        assert,
                        Promise,
                        util,
                        HttpTool,
                        waterline,
                        configuration){
    var logger = Logger.initialize(RestJobFactory);

    /**
     * The interface that runs Rest Job from tasks
     * @constructor
     */
    function RestJob(options, context, taskId){
        var self = this;
        self.options = options;
        self.context = context;

        RestJob.super_.call(self, logger, options, context, taskId);
        self.restClient = new HttpTool();
    }

    util.inherits(RestJob, BaseJob);

    RestJob.prototype._run = function run(){
        var self = this;
        return new Promise.resolve()
            .then(function(){
                return updateOptions(self);
            })
            .then(function(setup){
                logger.debug("setting up the redfish alert subcription");
                return self.restClient.setupRequest(setup);
            })
            .then(function(){
                logger.debug("Running The rest call for redfish subscription");
                return self.restClient.runRequest();
            })
            .then(function(data){
                self.context.restData = data;
                self._done();
            })
            .catch(function(err){
                logger.error("Found error during HTTP request.", {error: err});
                self._done(err);
            });
    };
<commit_msg>New Mongo doesn't store properties with dot notation (#559)<commit_after>// Copyright 2017, EMC, Inc

'use strict';

var di = require('di');

module.exports = RestJobFactory;
di.annotate(RestJobFactory, new di.Provide('Job.Redfish.Alert.Enable'));

di.annotate(RestJobFactory, new di.Inject(
    'Job.Base',
    'Logger',
    '_',
    'Assert',
    'Promise',
    'Util',
    'HttpTool',
    'Services.Waterline',
    'Services.Configuration'));


function RestJobFactory(BaseJob,
                        Logger,
                        _,
                        assert,
                        Promise,
                        util,
                        HttpTool,
                        waterline,
                        configuration){
    var logger = Logger.initialize(RestJobFactory);

    /**
     * The interface that runs Rest Job from tasks
     * @constructor
     */
    function RestJob(options, context, taskId){
        var self = this;
        self.options = options;
        self.context = context;

        RestJob.super_.call(self, logger, options, context, taskId);
        self.restClient = new HttpTool();
    }

    util.inherits(RestJob, BaseJob);

    RestJob.prototype._run = function run(){
        var self = this;
        return new Promise.resolve()
            .then(function(){
                return updateOptions(self);
            })
            .then(function(setup){
                logger.debug("setting up the redfish alert subcription");
                return self.restClient.setupRequest(setup);
            })
            .then(function(){
                logger.debug("Running The rest call for redfish subscription");
                return self.restClient.runRequest();
            })
            .then(function(data){
              self.context.restData = {};
              self.context.restData.httpStatusCode = data.httpStatusCode;

                self._done();
            })
            .catch(function(err){
                logger.error("Found error during HTTP request.", {error: err});
                self._done(err);
            });
    };

{'fraction_non_alphanumeric': 0.11206263763151456, 'fraction_numerical': 0.0026914607291411794, 'mean_word_length': 1.5791798107255521, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3731143', 'n_tokens_mistral': 1057, 'n_tokens_neox': 1002, 'n_words': 233}