/// <summary> /// Declares a new empty virtual dataset with the given Name. This will not have any virtual columns and will not be tied to any underlying tables. /// /// <para>The preferred method of getting a Catalogue is to use <see cref="TableInfoImporter"/> and <see cref="ForwardEngineerCatalogue"/></para> /// </summary> /// <param name="repository"></param> /// <param name="name"></param> public Catalogue(ICatalogueRepository repository, string name) { var loggingServer = repository.GetServerDefaults().GetDefaultFor(PermissableDefaults.LiveLoggingServer_ID); repository.InsertAndHydrate(this, new Dictionary <string, object>() { { "Name", name }, { "LiveLoggingServer_ID", loggingServer == null ? (object)DBNull.Value:loggingServer.ID } }); if (ID == 0 || string.IsNullOrWhiteSpace(Name) || Repository != repository) { throw new ArgumentException("Repository failed to properly hydrate this class"); } //default values if (Folder == null) { Folder = new CatalogueFolder(this, "\\"); } //if there is a default logging server if (LiveLoggingServer_ID == null) { var liveLoggingServer = repository.GetServerDefaults().GetDefaultFor(PermissableDefaults.LiveLoggingServer_ID); if (liveLoggingServer != null) { LiveLoggingServer_ID = liveLoggingServer.ID; } } ClearAllInjections(); }
private void SetupLogging(ICatalogueRepository repository) { //if we have already setup logging successfully then don't worry about doing it again if (_loggingServer != null && _logManager != null && _loggingTask != null) { return; } _loggingServer = repository.GetServerDefaults().GetDefaultFor(PermissableDefaults.LiveLoggingServer_ID); if (_loggingServer != null) { _logManager = new LogManager(_loggingServer); _loggingTask = _logManager.ListDataTasks().SingleOrDefault(task => task.ToLower().Equals("dqe")); if (_loggingTask == null) { _logManager.CreateNewLoggingTaskIfNotExists("DQE"); _loggingTask = "DQE"; } } else { throw new NotSupportedException( "You must set a Default LiveLoggingServer so we can audit the DQE run, do this through the ManageExternalServers dialog"); } }
public static ExternalDatabaseServer CreateNewExternalServer(ICatalogueRepository repository, PermissableDefaults defaultToSet, IPatcher patcher) { CreatePlatformDatabase createPlatform = new CreatePlatformDatabase(patcher); createPlatform.ShowDialog(); if (!string.IsNullOrWhiteSpace(createPlatform.DatabaseConnectionString)) { SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder(createPlatform.DatabaseConnectionString); var newServer = new ExternalDatabaseServer(repository, builder.InitialCatalog, patcher); newServer.Server = builder.DataSource; newServer.Database = builder.InitialCatalog; //if there is a username/password if (!builder.IntegratedSecurity) { newServer.Password = builder.Password; newServer.Username = builder.UserID; } newServer.SaveToDatabase(); if (defaultToSet != PermissableDefaults.None) { repository.GetServerDefaults().SetDefault(defaultToSet, newServer); } return(newServer); } return(null); }
/// <summary> /// Declares a new configuration for identifying patient lists matching a study requirements based on the results of cohort sets / patient index tables and set operations /// <see cref="CohortIdentificationConfiguration"/> /// </summary> /// <param name="repository"></param> /// <param name="name"></param> public CohortIdentificationConfiguration(ICatalogueRepository repository, string name) { var queryCache = repository.GetServerDefaults().GetDefaultFor(PermissableDefaults.CohortIdentificationQueryCachingServer_ID); repository.InsertAndHydrate(this, new Dictionary <string, object> { { "Name", name }, { "QueryCachingServer_ID", queryCache == null ? (object)DBNull.Value:queryCache.ID } }); }
/// <summary> /// Defines a new table reference in the platform database <paramref name="repository"/>. /// <para>Usually you should use <see cref="TableInfoImporter"/> instead</para> /// </summary> /// <param name="repository"></param> /// <param name="name"></param> public TableInfo(ICatalogueRepository repository, string name) { _catalogueRepository = repository; var dumpServer = repository.GetServerDefaults().GetDefaultFor(PermissableDefaults.IdentifierDumpServer_ID); repository.InsertAndHydrate(this, new Dictionary <string, object> { { "Name", name }, { "IdentifierDumpServer_ID", dumpServer == null ? (object)DBNull.Value:dumpServer.ID } }); ClearAllInjections(); }
public DQERepository(ICatalogueRepository catalogueRepository) { CatalogueRepository = catalogueRepository; var server = CatalogueRepository.GetServerDefaults().GetDefaultFor(PermissableDefaults.DQE); if (server == null) { throw new NotSupportedException("There is no DataQualityEngine Reporting Server (ExternalDatabaseServer). You will need to create/set one in CatalogueManager by using 'Locations=>Manage External Servers...'"); } DiscoveredServer = DataAccessPortal.GetInstance().ExpectServer(server, DataAccessContext.InternalDataProcessing); _connectionStringBuilder = DiscoveredServer.Builder; }
public ExecuteCommandCreateNewImagingDatasetSuite(IRDMPPlatformRepositoryServiceLocator repositoryLocator, DiscoveredDatabase databaseToCreateInto, DirectoryInfo projectDirectory) { _repositoryLocator = repositoryLocator; _catalogueRepository = repositoryLocator.CatalogueRepository; _databaseToCreateInto = databaseToCreateInto; _projectDirectory = projectDirectory; NewCataloguesCreated = new List <Catalogue>(); _loggingServer = _catalogueRepository.GetServerDefaults().GetDefaultFor(PermissableDefaults.LiveLoggingServer_ID); if (_loggingServer == null) { SetImpossible("No default logging server has been configured in your Catalogue database"); } CreateLoad = true; }
public static ExternalDatabaseServer CreateNewExternalServer(ICatalogueRepository repository, PermissableDefaults defaultToSet, IPatcher patcher) { CreatePlatformDatabase createPlatform = new CreatePlatformDatabase(patcher); createPlatform.ShowDialog(); var db = createPlatform.DatabaseCreatedIfAny; if (db != null) { var newServer = new ExternalDatabaseServer(repository, db.GetRuntimeName(), patcher); newServer.SetProperties(db); if (defaultToSet != PermissableDefaults.None) { repository.GetServerDefaults().SetDefault(defaultToSet, newServer); } return(newServer); } return(null); }