private bool CanRun(WorkInfo workInfo) { if (!InputNodes.All(node => node.IsConnected())) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"{this.DisplayName} input node is not connected with any other module"); return(false); } string prevModuleName = workInfo.NextModuleRTL(this).DisplayName; if (workInfo.Schema == null) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as Previous Module {prevModuleName} dis not pass Schema"); return(false); } foreach (var node in InputNodes) { if (node.State == null) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as InputNode.State is null"); return(false); } node.State.DataFilePath = ((OutputNode)node.Connector).State.DataFilePath; node.State.Schema = ((OutputNode)node.Connector).State.Schema; node.State.DataFile = ((OutputNode)node.Connector).State.DataFile; if (node.State.DataFilePath == null) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as InputNode.State.DataFilePath is null"); return(false); } if (!File.Exists(node.State.DataFilePath)) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as {node.State.DataFilePath} does not exist "); return(false); } if (node.State.DataFile == null) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as DataFile is null"); return(false); } } for (int i = 0; i < OutputNodes.Count; i++) { if (OutputNodes[i].Connector.IsConnected() == false) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as OutputNode is not connected"); return(false); } if (((InputNode)OutputNodes[i].Connector).State == null) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as OutputNode.State is null"); return(false); } } SetOutputSchemas(); return(true); }
private bool CanRun(WorkInfo workInfo) { if (!IsConnected()) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"{this.DisplayName} input node is not connected with any other module"); return(false); } string prevModuleName = workInfo.NextModuleRTL(this).DisplayName; if (workInfo.Schema == null) { workInfo.Log(this.DisplayName, NLog.LogLevel.Error, $"Halting execution as Previous Module {prevModuleName} dis not pass Schema"); 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.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 (!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 msg = ""; if (FilterFields.Count <= 0) { msg = string.Format("Halting execution as as filter fields are not provided"); logger.Warn(msg); workInfo.Log(this.DisplayName, NLog.LogLevel.Error, msg); return(false); } /* * string prevNodeName = InputModule.DisplayName; * var workFlow = InputModule.GetState(InputModule); * var state = ((OutputNode)this.InputNode.Connector).State; * var schema = ((OutputNode)this.InputNode.Connector).GetSchema(); */ /* * if (!File.Exists(state.InputPath)) * { * MessageService.ShowError("Data Connection Error", $"In Module {prevModName} Sate has invalid input path"); * return false; * } */ return(true); }
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); }