public static void WriteVerbose(this SreTraceLogWriter traceLog, string message) { if (Information.TraceFilter.HasFlag(SourceLevels.Verbose)) { traceLog.Write(message); } }
public Attribute(int id, string name, string value, string unknownMessage, SreTraceLogWriter traceWriter, bool isAcceptableOrPrintable, bool isAssociatedWithSystemRow = false, int?attributePrintValueType = 0, string attributePrintValueCustom = null) { this.IsAcceptableOrPrintable = isAcceptableOrPrintable; this.IsAssociatedWithSystemRow = isAssociatedWithSystemRow; OriginalValue = value; Init(id, name, value, unknownMessage, attributePrintValueType, attributePrintValueCustom); this.TraceWriter = traceWriter; }
protected override void Execute(CodeActivityContext context) { WorkerData data = context.GetValue(this.Data); int originalPosition = context.GetValue(this.OriginalPostion); data.Job.PerformanceCounter.Start(data.Job.JobIdentifier, RowPerformanceTaskNames.RowValidateMandatory, originalPosition); SreTraceLogWriter traceLog = data.CurrentRow.TraceLog; if ((data.CurrentRow.HasAnyError()) && (data.CurrentRow.IsValidForced == false)) { data.CurrentRow.ColumnsSystem["IsValid"].Value = "false"; } data.Job.PerformanceCounter.Stop(data.Job.JobIdentifier, RowPerformanceTaskNames.RowValidateMandatory, originalPosition); }
protected override void Execute(CodeActivityContext context) { WorkerData data = context.GetValue(this.Data); int originalPosition = context.GetValue(this.OriginalPostion); SreTraceLogWriter traceLog = data.CurrentRow.TraceLog; data.Job.PerformanceCounter.Start(data.Job.JobIdentifier, RowPerformanceTaskNames.ParseDataTypes_ParseInit, originalPosition); AttributeParser dtp = new AttributeParser(data.Job.DataSource.Id, data.Job.DataSource.Name, data.CurrentRow.ColumnsSystem, data.Job.Parameters, data.Job.SqlClientManager, data.Job.DataSource.Keys); data.Job.PerformanceCounter.Stop(data.Job.JobIdentifier, RowPerformanceTaskNames.ParseDataTypes_ParseInit, originalPosition); data.Job.PerformanceCounter.Start(data.Job.JobIdentifier, RowPerformanceTaskNames.ParseDataTypes_AttributesSystem1, originalPosition); dtp.Parse(data.Job.DataSource.AttributesSystem, data.CurrentRow.ColumnsSystem, true, originalPosition, true); //If anything can be processed without input attributes. data.Job.PerformanceCounter.Stop(data.Job.JobIdentifier, RowPerformanceTaskNames.ParseDataTypes_AttributesSystem1, originalPosition); data.Job.PerformanceCounter.Start(data.Job.JobIdentifier, RowPerformanceTaskNames.ParseDataTypes_Attributes, originalPosition); dtp.Parse(data.Job.DataSource.Attributes, data.CurrentRow.Columns, false, originalPosition, false); data.Job.PerformanceCounter.Stop(data.Job.JobIdentifier, RowPerformanceTaskNames.ParseDataTypes_Attributes, originalPosition); data.Job.PerformanceCounter.Start(data.Job.JobIdentifier, RowPerformanceTaskNames.ParseDataTypes_AttributesSystem2, originalPosition); dtp.OtherAvailableAttributes = data.CurrentRow.Columns; dtp.Parse(data.Job.DataSource.AttributesSystem, data.CurrentRow.ColumnsSystem, true, originalPosition, false); //If anything to be processed with input attributes. data.Job.PerformanceCounter.Stop(data.Job.JobIdentifier, RowPerformanceTaskNames.ParseDataTypes_AttributesSystem2, originalPosition); }
protected override void Execute(CodeActivityContext context) { WorkerData data = context.GetValue(this.Data); int originalPosition = context.GetValue(this.OriginalPostion); SreTraceLogWriter traceLog = data.CurrentRow.TraceLog; data.Job.PerformanceCounter.Start(data.Job.JobIdentifier, RowPerformanceTaskNames.ParseDataTypes_ParseAgain, originalPosition); data.ValueUpdationNotPermitted = true; for (int c = 0; c < data.CurrentRow.Columns.Count; c++) { //if (data.CurrentRow.Columns[c].Name == "AssetId") // Debugger.Break(); if (data.CurrentRow.Columns[c].HasBusinessError) { continue; } IdpeMessage sreMsg = data.CurrentRow.Columns[c].Type.Parse(true); if (data.CurrentRow.Columns[c].Type is SreCodeset) { SreCodeset sreCodeset = data.CurrentRow.Columns[c].Type as SreCodeset; data.CurrentRow.Columns[c].ValueEnumCode = sreCodeset.ValueEnumCode; data.CurrentRow.Columns[c].ValueEnumValue = sreCodeset.ValueEnumValue; data.CurrentRow.Columns[c].ValueEnumReferenceKey = sreCodeset.ReferenceKey; } if ((sreMsg.Code != IdpeMessageCodes.IDPE_SUCCESS) && (sreMsg.Code != data.CurrentRow.Columns[c].Error.Code)) { string oldMsg = data.CurrentRow.Columns[c].Error.Message; data.CurrentRow.Columns[c].Error = sreMsg; data.CurrentRow.Columns[c].Error.Message = string.Format("{0},{1}", oldMsg, data.CurrentRow.Columns[c].Error.Message); } else { data.CurrentRow.Columns[c].Error = sreMsg; } } for (int c = 0; c < data.CurrentRow.ColumnsSystem.Count; c++) { if ((data.CurrentRow.ColumnsSystem[c].Name == "IsValid") || (data.CurrentRow.ColumnsSystem[c].Value == "NULL") || (data.CurrentRow.ColumnsSystem[c].IsNull)) { data.CurrentRow.ColumnsSystem[c].Error.Message = string.Empty; //Clear error when INT type updated with using 'lookup' and it returned 'NULL' continue; } //if (data.CurrentRow.ColumnsSystem[c].Name == "AssetId") // Debugger.Break(); IdpeMessage sreMsg = data.CurrentRow.ColumnsSystem[c].Type.Parse(true); if (data.CurrentRow.ColumnsSystem[c].Type is SreCodeset) { SreCodeset sreCodeset = data.CurrentRow.ColumnsSystem[c].Type as SreCodeset; data.CurrentRow.ColumnsSystem[c].ValueEnumCode = sreCodeset.ValueEnumCode; data.CurrentRow.ColumnsSystem[c].ValueEnumValue = sreCodeset.ValueEnumValue; data.CurrentRow.ColumnsSystem[c].ValueEnumReferenceKey = sreCodeset.ReferenceKey; } if ((data.CurrentRow.ColumnsSystem[c].HasBusinessError) && (sreMsg.Code != IdpeMessageCodes.IDPE_SUCCESS)) { //has business error, parsing failed string oldMsg = data.CurrentRow.ColumnsSystem[c].Error.Message; data.CurrentRow.ColumnsSystem[c].Error = sreMsg; data.CurrentRow.ColumnsSystem[c].Error.Message = string.Format("{0},{1}", oldMsg, data.CurrentRow.ColumnsSystem[c].Error.Message); } else if ((data.CurrentRow.ColumnsSystem[c].HasBusinessError) && (sreMsg.Code == IdpeMessageCodes.IDPE_SUCCESS)) { //has business error, parsing passed //don't do anything, let the error continue } else { data.CurrentRow.ColumnsSystem[c].Error = sreMsg; } } data.Job.PerformanceCounter.Stop(data.Job.JobIdentifier, RowPerformanceTaskNames.ParseDataTypes_ParseAgain, originalPosition); }
protected override void Execute(CodeActivityContext context) { WorkerData data = context.GetValue(this.Data); DataRow dataRow = context.GetValue(this.DataRow); int originalRowPosition = (int)dataRow[Constants.ColumnNamePosition].ToString().ParseInt(); OriginalPosition.Set(context, originalRowPosition); string containerError = dataRow[Constants.ColumnNameContainerError].ToString(); //data.Job.InputData.Rows[originalRowPosition - 1][Constants.ColumnNameContainerError].ToString(); int rawColumnPosition = 1; //skip first 2 columns data.Job.PerformanceCounter.Start(data.Job.JobIdentifier, RowPerformanceTaskNames.LoopPreset, originalRowPosition); //fill Columns with incoming data, which might got modified in PreParse BS, and then get parsed. data.Rows.Add(new Row(originalRowPosition)); SreTraceLogWriter traceLog = data.CurrentRow.TraceLog; foreach (IdpeAttribute a in data.Job.DataSource.Attributes) { string value = string.Empty; if (a.IsAcceptable == true) { rawColumnPosition++; value = dataRow[rawColumnPosition].ToString(); } data.CurrentRow.Columns.Add(new Attribute(a.AttributeId, a.Name, value, string.Empty, traceLog, (bool)a.IsAcceptable)); } foreach (IdpeAttribute a in data.Job.DataSource.AttributesSystem) { data.CurrentRow.ColumnsSystem.Add(new Attribute(a.AttributeId, a.Name, string.Empty, string.Empty, traceLog, (bool)a.IsAcceptable, true, a.AttributePrintValueType, a.AttributePrintValueCustom)); } Attribute attrbIsValid = data.CurrentRow.ColumnsSystem["IsValid"]; if (!string.IsNullOrEmpty(containerError)) { ThisRowIsHavingContainerError.Set(context, true); traceLog.WriteLine("The row '{0}' has container validation errors, skipping it.", originalRowPosition); if (attrbIsValid != null) { attrbIsValid.Value = "false"; if (attrbIsValid.Error != null) { attrbIsValid.Error.Message = data.PrintRowColPosition(originalRowPosition, "*") + containerError; } else { containerError = string.Format("Row[{0}][IsValid]:{1}", originalRowPosition, containerError); attrbIsValid.Error = new IdpeMessage(containerError); } //Lets instantiate attribute results with a generic error, // else it will be null and throw error through out the life cycle. foreach (Attribute a in data.CurrentRow.Columns) { a.Error = new IdpeMessage(IdpeMessageCodes.IDPE_FAILED_BLANK); } foreach (Attribute a in data.CurrentRow.ColumnsSystem) { if (!a.Name.Equals("IsValid", StringComparison.OrdinalIgnoreCase)) { a.Error = new IdpeMessage(IdpeMessageCodes.IDPE_FAILED_BLANK); } } } } else { ThisRowIsHavingContainerError.Set(context, false); if (attrbIsValid != null) { attrbIsValid.Value = "true"; //by default true, if any error occurres, will be false in 'Finally' } else { data.Errors.Add(string.Format("{0}Critical mandatory system attribute 'IsValid' not found in the collection.", data.PrintRowColPosition(originalRowPosition, "", true))); } } data.ValueUpdationNotPermitted = false; data.Job.PerformanceCounter.Stop(data.Job.JobIdentifier, RowPerformanceTaskNames.LoopPreset, originalRowPosition); }