/// <summary>
 /// Create injected service
 /// </summary>
 public MdmDataManagementService(IServiceManager serviceManager, IConfigurationManager configuration, IDataCachingService cachingService = null, IRecordMatchingConfigurationService matchConfigurationService = null, IRecordMatchingService matchingService = null, ISubscriptionExecutor subscriptionExecutor = null, SimDataManagementService simDataManagementService = null, IJobManagerService jobManagerService = null)
 {
     this.m_configuration             = configuration.GetSection <ResourceManagementConfigurationSection>();
     this.m_matchingService           = matchingService;
     this.m_serviceManager            = serviceManager;
     this.m_subscriptionExecutor      = subscriptionExecutor;
     this.m_jobManager                = jobManagerService;
     this.m_matchConfigurationService = matchConfigurationService;
     this.m_dataCachingService        = cachingService;
     if (simDataManagementService != null)
     {
         throw new InvalidOperationException("Cannot run MDM and SIM in same mode");
     }
 }
Example #2
0
        /// <summary>
        /// Create a match job
        /// </summary>
        public MdmMatchJob(IRecordMergingService <T> recordMergingService, IJobManagerService jobManager, IJobStateManagerService stateManagerService)
        {
            this.m_id = new Guid(MD5.Create().ComputeHash(Encoding.ASCII.GetBytes(typeof(T).Name)));

            this.m_mergeService = recordMergingService;
            this.m_stateManager = stateManagerService;

            // Progress change handler
            if (this.m_mergeService is IReportProgressChanged rpt)
            {
                rpt.ProgressChanged += (o, p) =>
                {
                    this.m_stateManager.SetProgress(this, p.State.ToString(), p.Progress);
                };
            }
        }
        /// <summary>
        /// ADO freetext constructor
        /// </summary>
        public AdoFreetextSearchService(IJobManagerService jobManager, IServiceManager serviceManager, IConfigurationManager configurationManager, IThreadPoolService threadPoolService)
        {
            this.m_configuration = configurationManager.GetSection <AdoPersistenceConfigurationSection>();

            this.m_ftiRefreshThread = new Thread(this.MonitorFreetextJob)
            {
                Name         = "ADO.NET FullText Realtime Refresh",
                IsBackground = true,
                Priority     = ThreadPriority.Lowest
            };
            this.m_ftiRefreshThread.Start();

            if (this.m_configuration.Provider.GetFilterFunction("freetext") == null)
            {
                return;                                                                      // Freetext not supported
            }
            var job = serviceManager.CreateInjected <AdoRebuildFreetextIndexJob>();

            jobManager.AddJob(job, JobStartType.TimerOnly);
            if (jobManager.GetJobSchedules(job)?.Any() != true)
            {
                jobManager.SetJobSchedule(job, new DayOfWeek[] { DayOfWeek.Saturday }, new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0));
            }

            // Subscribe to common types and events
            var appServiceProvider = ApplicationServiceContext.Current;

            appServiceProvider.GetService <IDataPersistenceService <Bundle> >().Inserted               += (o, e) => e.Data.Item.ForEach(i => this.ReIndex(i));
            appServiceProvider.GetService <IDataPersistenceService <Patient> >().Inserted              += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <Provider> >().Inserted             += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <Material> >().Inserted             += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <ManufacturedMaterial> >().Inserted += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <Entity> >().Inserted               += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <Place> >().Inserted               += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <Organization> >().Inserted        += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <Person> >().Inserted              += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <Patient> >().Updated              += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <Provider> >().Updated             += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <Material> >().Updated             += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <ManufacturedMaterial> >().Updated += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <Entity> >().Updated               += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <Place> >().Updated        += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <Organization> >().Updated += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.GetService <IDataPersistenceService <Person> >().Updated       += (o, e) => this.ReIndex(e.Data);
            appServiceProvider.Stopping += (o, e) => this.m_shutdown = true;
        }
        /// <summary>
        /// DI constructor
        /// </summary>
        public LocalBiRenderService(IServiceManager serviceManager, IJobManagerService jobManager, IBiMetadataRepository metadataRepository, IBiDataSource defaultDataSource = null)
        {
            this.m_serviceManager = serviceManager;
            var job = serviceManager.CreateInjected <BiMaterializeJob>();

            jobManager.AddJob(job, JobStartType.TimerOnly);  // Set default job
            if (jobManager.GetJobSchedules(job)?.Any() != true)
            {
                jobManager.SetJobSchedule(job, new DayOfWeek[]
                {
                    DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday, DayOfWeek.Sunday
                }, new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0)); // First run for tomorrow
            }

            // Scan and initialize all BI materialized views
            ApplicationServiceContext.Current.Started += (o, e) =>
            {
                foreach (var itm in metadataRepository.Query <BiQueryDefinition>(x => x.MetaData.Status == BiDefinitionStatus.Active, 0, 100))
                {
                    try
                    {
                        IBiDataSource dataSource      = null;
                        var           queryDefinition = BiUtils.ResolveRefs(itm) as BiQueryDefinition;
                        var           providerType    = queryDefinition.DataSources.FirstOrDefault()?.ProviderType;
                        if (providerType != null)
                        {
                            dataSource = this.m_serviceManager.CreateInjected(providerType) as IBiDataSource;
                        }
                        else
                        {
                            dataSource = defaultDataSource;
                        }

                        this.m_tracer.TraceInfo("Materializing views for {0}", queryDefinition.Id);
                        dataSource.CreateMaterializedView(queryDefinition);
                    }
                    catch (Exception ex)
                    {
                        this.m_tracer.TraceWarning("Could not initialize materialized views for {0} - {1}", itm.Id, ex.Message);
                    }
                }
            };
        }
Example #5
0
 /// <summary>
 /// Creates a new configuration match operation
 /// </summary>
 public MdmMatchOperation(IConfigurationManager configurationManager, IJobManagerService jobManager, IDataPersistenceService <Bundle> batchService) : base(configurationManager, batchService)
 {
     this.m_jobManager = jobManager;
 }
Example #6
0
 /// <summary>
 /// DI constructor
 /// </summary>
 public StartJobOperation(IJobManagerService managerService)
 {
     this.m_manager = managerService;
 }
        /// <summary>
        /// Synchronized dispatch service
        /// </summary>
        public SynchronizedAuditDispatchService(IConfigurationManager configurationManager, IJobStateManagerService jobStateManager, IJobManagerService scheduleManager, IThreadPoolService threadPool, IQueueManagerService queueManagerService)
        {
            this.m_securityConfiguration = configurationManager.GetSection <SecurityConfigurationSection>();
            this.m_jobStateManager       = jobStateManager;
            this.m_queueManagerService   = queueManagerService;

            if (!scheduleManager.GetJobSchedules(this).Any())
            {
                scheduleManager.SetJobSchedule(this, new TimeSpan(0, 5, 0));
            }

            threadPool.QueueUserWorkItem(_ =>
            {
                try
                {
                    AuditData securityAlertData = new AuditData(DateTime.Now, ActionType.Execute, OutcomeIndicator.Success, EventIdentifierType.SecurityAlert, AuditUtil.CreateAuditActionCode(EventTypeCodes.AuditLoggingStarted));
                    AuditUtil.AddLocalDeviceActor(securityAlertData);
                    AuditUtil.SendAudit(securityAlertData);
                }
                catch (Exception ex)
                {
                    this.m_tracer.TraceError("Error starting up audit repository service: {0}", ex);
                }
            });
        }
 /// <summary>
 /// DI constructor
 /// </summary>
 public JobResourceHandler(ILocalizationService localizationService, IJobManagerService jobManagerService, IJobStateManagerService jobStateManagerService)
 {
     this.m_jobManager          = jobManagerService;
     this.m_jobStateService     = jobStateManagerService;
     this.m_localizationService = localizationService;
 }
 /// <summary>
 /// DI constructor
 /// </summary>
 public CancelJobOperation(IJobManagerService managerService)
 {
     this.m_manager = managerService;
 }