public void Initialize() { DataProcessorGlobal.IsDebugEnabled = true; var path = Path.Combine(_testDirectory, "TestFiles", "balance-with-header-and-trailer.definition.20.xml"); _inputDefinitionFile = FileLoader.Load <InputDefinitionFile20>(path); _fileProcessorDefinition = ProcessorDefinition.FileProcessorDefinitionBuilder.CreateFileProcessorDefinition(_inputDefinitionFile); }
protected override void OnInitialized() { base.OnInitialized(); ApplicationsEvents.MenuItemClicked += MenuItemClicked; if (LoadedFilePageState.ParsedDataAndSpec20 != null) { _parsedData = LoadedFilePageState.ParsedDataAndSpec20.ParsedData; _inputDefinitionFile = LoadedFilePageState.ParsedDataAndSpec20.InputDefinitionFile; } }
public static FileProcessorDefinition20 CreateFileProcessorDefinition(InputDefinitionFile20 inputDefinitionFile_20) { var aggregateManager = new AggregateManager(); var processorDefinition = new FileProcessorDefinition20(); InitializeFileProcessorDefinition(processorDefinition, inputDefinitionFile_20, aggregateManager); processorDefinition.DataRowProcessorDefinitions = LoadRowProcessorDefinitions(inputDefinitionFile_20.Datas, aggregateManager); processorDefinition.KeyField = inputDefinitionFile_20.Datas.KeyField; processorDefinition.DataTypeField = inputDefinitionFile_20.Datas.DataTypeField; ResolveDataTypeField(processorDefinition); var fieldProcessorDefinitionsInDataRows = processorDefinition.DataRowProcessorDefinitions.SelectMany(a => a.Value.RowProcessorDefinition.FieldProcessorDefinitions); InitializeRules(fieldProcessorDefinitionsInDataRows.SelectMany(a => a.Rules), aggregateManager.GetAggregates()); InitializeRules(processorDefinition.TrailerRowProcessorDefinition.FieldProcessorDefinitions.SelectMany(a => a.Rules), aggregateManager.GetAggregates()); return(processorDefinition); }
public void Serialize() { var target = new InputDefinitionFile20 { Name = "TestFile", Description = "Demo definition file with two data types", Version = "1.0", FrameworkVersion = "2.0" }; target.Header = new RowDefinition { Fields = new FieldDefinition[] { CreateFieldDefinition("FileType", "Record Type Header", "TextDecoder", "HD", ValidationResultType.Error), CreateFieldDefinition("CreationDate", "Creation Date", "DateDecoder", "MMddyyyy", ValidationResultType.Error) } }; var depositRow = new RowDefinition { DataType = "DP", Fields = new FieldDefinition[] { CreateFieldDefinition("RecordType", "Record Type Deposit", "TextDecoder", "DP", ValidationResultType.Error), CreateFieldDefinition("ConsumerId", "Consumer Id", "TextDecoder", "[a-zA-Z0-9]{1,16}", ValidationResultType.Error), CreateFieldDefinition("Date", "Date of deposit", "DateDecoder", "MMddyyyy", ValidationResultType.Error), CreateFieldDefinition("Amount", "Amount", "DecimalDecoder", @"(?!0+)([0-9]{1,2},)?([0-9]{1,3},)?([0-9]{1,3},)?[0-9]{1,3}\.[0-9]{2}", ValidationResultType.Error) } }; var changeRow = new RowDefinition { DataType = "CH", Fields = new FieldDefinition[] { CreateFieldDefinition("RecordType", "Record Type Change", "TextDecoder", "CH", ValidationResultType.Error), CreateFieldDefinition("ConsumerId", "Consumer Id", "TextDecoder", "[a-zA-Z0-9]{1,16}", ValidationResultType.Error), CreateFieldDefinition("Date", "Date of change", "DateDecoder", "MMddyyyy", ValidationResultType.Error), CreateFieldDefinition("AddressLine1", "Street address", "TextDecoder", @"\s*(?:\S\s*){3,100}", ValidationResultType.Error), CreateFieldDefinition("AddressLine2", "Apartment or suite", "TextDecoder", @"\s*(?:\S\s*){3,100}", ValidationResultType.Error) } }; target.Datas = new Datas { KeyField = "ConsumerId", DataTypeField = "RecordType", MasterDataType = "DP", Rows = new RowDefinition[] { depositRow, changeRow } }; target.Trailer = new RowDefinition { Fields = new FieldDefinition[] { CreateFieldDefinition("RecordType", "Record Type Tariler", "TextDecoder", "TR", ValidationResultType.Error), CreateFieldDefinition("DepositCount", "Record Count for Deposit", "IntegerDecoder", @"\d{1,5}", ValidationResultType.Error), CreateFieldDefinition("ChangeCount", "Record Count for Change", "IntegerDecoder", @"\d{1,5}", ValidationResultType.Error), CreateFieldDefinition("DepositTotal", "Total deposit amounts", "DecimalDecoder", @"(?!0+)([0-9]{1,2},)?([0-9]{1,3},)?([0-9]{1,3},)?[0-9]{1,3}\.[0-9]{2}", ValidationResultType.Error), } }; var xml = HelperXmlSerializer.Serialize(target); TestContext.WriteLine(xml); }