private void RunSegment( int segmentIndex, int segmentCount, SegmentConfiguration segmentConfiguration, IBootstrapper bootstrapper, ISafeRepository safeRepository) { this.SetupConfigurationProvider(segmentConfiguration, bootstrapper); IContext context = this.SetupContext( segmentConfiguration, segmentIndex, segmentCount, bootstrapper, safeRepository); IBridge bridge = this.bridgeFactory.CreateBridge( segmentConfiguration.Type, context.EntityType.Type, bootstrapper); IInvocableInitializer invocableInitializer = bootstrapper.Get <IInvocableInitializer>(); bridge.ContextValidator.Validate(context); ISegmentRunner segmentRunner = bridge.CreateSegmentRunner(); bridge.EventDispatcher.SegmentExecuting(new SegmentExecutingArgs()); invocableInitializer.Initialize(bridge.EventDispatcher); segmentRunner.Run(); bridge.EventDispatcher.SegmentExecuted(new SegmentExecutedArgs()); }
private void ScrapeSegmentDataBy(string hl7Version) { HL7SchemaRepository repo = new HL7SchemaRepository(); List <string> collection = new List <string>(); SegmentConfiguration segmentConfig = repo.GetSegmentConfigurationByVersion(hl7Version); if (segmentConfig != null) { string[] segmentsToScrape = segmentConfig.Segments.Split(','); string[] currentSegments = repo.GetDistinctSegmentsBy(hl7Version); List <string> segmentsNeeded = segmentsToScrape.Except(currentSegments).ToList(); Parallel.ForEach(segmentsNeeded, (segmentData) => { CreateSegment(hl7Version, segmentData); }); } else { _fileLogger.LogMessage(LogMessageType.INFO, string.Format("No segment configuration found for HL7 version {0}", hl7Version)); } }
private string GetSourceSystemName(SegmentConfiguration segmentConfiguration) { return(this.GetInheritedOverridenValue( segmentConfiguration.SourceSystem, this.parent.configuration.Value.RunConfiguration.SourceSystem, this.parent.configuration.Value.ApplicationConfiguration.SourceSystem)); }
public IContext CreateContext( IBootstrapper bootstrapper, SegmentConfiguration segmentConfiguration, int segmentIndex, int segmentCount, IDictionary <string, object> runData) { IContext context; IEnumerable <IExternalSystem> externalSystems = this.CreateExternalSystems(); IExternalSystem sourceSystem = this.GetSourceSystem(segmentConfiguration, externalSystems); IEnumerable <IEntityType> entityTypes = this.CreateEntityTypes(sourceSystem, externalSystems); IEntityType entityType = this.GetEntityType(segmentConfiguration.EntityType, entityTypes); IReadOnlyDictionary <string, string> parameters = this.AssembleParameters(bootstrapper, entityType, sourceSystem); context = new Context( segmentConfiguration.Type, segmentIndex, segmentCount, sourceSystem, entityType, externalSystems, entityTypes, parameters, runData); return(context); }
public ConfigurationProvider( ConfigurationWrapper configuration, SegmentConfiguration segmentConfiguration) { this.configuration = configuration; this.segmentConfiguration = segmentConfiguration; }
private void SetupConfigurationProvider( SegmentConfiguration segmentConfiguration, IBootstrapper bootstrapper) { IWritableConfigurationProvider writableConfigurationProvider = bootstrapper.Get <IWritableConfigurationProvider>(); writableConfigurationProvider .SetConfigurationProvider(new ConfigurationProvider( this.configuration.Value, segmentConfiguration)); }
private IExternalSystem GetSourceSystem( SegmentConfiguration segmentConfiguration, IEnumerable <IExternalSystem> externalSystems) { IExternalSystem sourceSystem = null; string sourceSystemName = this.GetSourceSystemName(segmentConfiguration); if (sourceSystemName != null) { sourceSystem = this.parent.Single( externalSystems, this.GetSourceSystemName(segmentConfiguration), externalSystem => externalSystem.Name, Resources.SourceSystemNotFound); } return(sourceSystem); }
private void RunSegment( int segmentIndex, int segmentCount, SegmentConfiguration segmentConfiguration) { using (IBootstrapper bootstrapper = this.bootstrapperFactory.CreateBootstrapper()) { using (ISafeRepository safeRepository = bootstrapper.Get <ISafeRepository>()) { this.RunSegment( segmentIndex, segmentCount, segmentConfiguration, bootstrapper, safeRepository); } } }
private IContext SetupContext( SegmentConfiguration segmentConfiguration, int segmentIndex, int segmentCount, IBootstrapper bootstrapper, ISafeRepository safeRepository) { IContext context = this .GetContextFactory(safeRepository) .CreateContext( bootstrapper, segmentConfiguration, segmentIndex, segmentCount, this.runData); IWritableContext writableContext = bootstrapper.Get <IWritableContext>(); writableContext.SetContext(context); return(context); }