/// <summary>
        /// Override method to deserialize a JSON string into a QueuerProcess
        /// </summary>
        /// <returns></returns>
        public override object ReadJson(JsonReader Reader, Type ObjectType, object ExistingValue, JsonSerializer Serializer)
        {
            //Validate Arguments
            //if (Serializer == null)
            //{
            //    throw new ArgumentNullException(ExceptionHelper.GetStaticException("GeneralNullArgument", new string[] { "Serializer" }, new System.Globalization.CultureInfo("en-GB")));
            //}

            //if (Reader == null)
            //{
            //    throw new ArgumentNullException(ExceptionHelper.GetStaticException("GeneralNullArgument", new string[] { "Reader" }, new System.Globalization.CultureInfo("en-GB")));
            //}

            //Deserialize reader into surrogate object
            QueuerProcessSurrogate SurrogateQueuerProcess = Serializer.Deserialize <QueuerProcessSurrogate>(Reader);

            return(new QueuerProcess(SurrogateQueuerProcess, this._Environment));
        }
Exemple #2
0
        internal QueuerProcess(QueuerProcessSurrogate SurrogateQueuerProcess, string Environment)
        {
            this._AppAPIKey     = SurrogateQueuerProcess.AppAPIKey;
            this._AppUserAPIKey = SurrogateQueuerProcess.AppUserAPIKey;
            this._QueueTime     = SurrogateQueuerProcess.QueueTime;
            this._ExecuteNow    = SurrogateQueuerProcess.ExecuteNow;
            this._Key           = SurrogateQueuerProcess.Key;
            this._Environment   = Environment;
            this._ID            = new ObjectId(SurrogateQueuerProcess._id);

            //Dictionary to store function mapping
            Dictionary <string, Action> ProcessMapping = new Dictionary <string, Action>
            {
                { "GroundFrame.Queuer.Tasks.SeedSimulationFromWTT", (() => this._Request = new SeedSimulationFromWTT(this._Key, this._AppUserAPIKey, this._AppAPIKey, this._Environment, SurrogateQueuerProcess.Request.Config.ToJson())) }
            };

            //Map the task requested to the relevant IQueuerRequest object
            ProcessMapping[SurrogateQueuerProcess.TaskType]();

            this._Request.ReplaceResponses(SurrogateQueuerProcess.Request.Responses);
        }