示例#1
0
        private bool ValidateSchemaPass()
        {
            if (InputNode.IsConnected() == false)
            {
                MessageService.ShowError("DataSorter Data Connection Error", "Data Sorter module input node is not connected with any other module");
                return(false);
            }

            string prevModName = InputModule.DisplayName;
            var    workFlow    = InputModule.GetState(InputModule);
            var    state       = ((OutputNode)this.InputNode.Connector).State;
            var    schema      = ((OutputNode)this.InputNode.Connector).GetSchema();

            if (state == null)
            {
                MessageService.ShowError("DataSorter Data Connection Error", $"In Module {prevModName} passed invalid state object");
                return(false);
            }



            if (state.Schema == null)
            {
                MessageService.ShowError("DataSorter Data Connection Error", $"In Module {prevModName} Sate has invalid Schema");
                return(false);
            }


            return(true);
        }
示例#2
0
        private bool CanRun(WorkInfo workInfo)
        {
            if (InputNode.IsConnected() == false)
            {
                workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"{this.DisplayName} input node is not connected with any other module");
                return(false);
            }



            if (this.InputNode.State == null)
            {
                workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as InputNode.State is null");
                return(false);
            }

            this.InputNode.State.DataFilePath = ((OutputNode)this.InputNode.Connector).State.DataFilePath;
            this.InputNode.State.DataFile     = ((OutputNode)this.InputNode.Connector).State.DataFile;
            this.InputNode.State.Schema       = ((OutputNode)this.InputNode.Connector).State.Schema;

            if (this.InputNode.State.DataFilePath == null)
            {
                workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as InputNode.State.DataFilePath is null");
                return(false);
            }
            if (this.InputNode.State.DataFile == null)
            {
                this.InputNode.State.DataFile = WorkflowFileFactory.LoadFromXmlFile(this.InputNode.State.DataFilePath);
                //workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as InputNode.State.DataFile is null");
                //return false;
            }

            if (!File.Exists(this.InputNode.State.DataFilePath))
            {
                workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as {InputNode.State.DataFilePath} does not exist ");
                return(false);
            }

            string prevModuleName = workInfo.NextModuleRTL(this).DisplayName;

            if (InputNode.State.Schema == null)
            {
                workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as Previous Module {prevModuleName} dis not pass Schema");
                return(false);
            }

            if (OutputNode.IsConnected() == false)
            {
                workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as OutputNode is not connected");
                return(false);
            }

            if (OutputNode.State == null)
            {
                workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as OutputNode.State is null");
                return(false);
            }

            if (string.IsNullOrEmpty(OutputNode.State.DataFilePath))
            {
                workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as OutputNode.DataFilePath is not set");
                return(false);
            }
            this.OutputNode.State.Schema   = this.InputNode.State.Schema;
            this.OutputNode.State.DataFile = this.InputNode.State.DataFile;

            string msg = "";

            if (SortingFields.Count <= 0)
            {
                msg = string.Format("Halting execution as as sorting fields are not provided");
                logger.Warn(msg);

                workInfo.Log(this.DisplayName, NLog.LogLevel.Error, msg);
                return(false);
            }


            return(true);
        }