Example #1
0
        public GatheredObject GatherDependencies(LoadMetadata loadMetadata)
        {
            //Share the LoadMetadata
            var root = new GatheredObject(loadMetadata);

            //and the catalogues behind the load
            foreach (var cata in loadMetadata.GetAllCatalogues())
            {
                root.Children.Add(GatherDependencies(cata));
            }

            //and the load operations
            foreach (IProcessTask processTask in loadMetadata.ProcessTasks)
            {
                var gpt = new GatheredObject(processTask);
                root.Children.Add(gpt);

                foreach (IArgument a in processTask.GetAllArguments())
                {
                    var ga = new GatheredObject(a);
                    gpt.Children.Add(ga);
                }
            }

            return(root);
        }
        public ExecuteCommandViewLoadDiagram(IActivateItems activator, LoadMetadata loadMetadata) : base(activator)
        {
            _loadMetadata = loadMetadata;

            if (!_loadMetadata.GetAllCatalogues().Any())
            {
                SetImpossible("Load does not have any associated Catalogues (no tables are loaded by the load)");
            }
        }
Example #3
0
        public void DeleteTask()
        {
            _task.DeleteInDatabase();

            _lmd.GetDistinctTableInfoList(true).ForEach(t => t.DeleteInDatabase());
            _lmd.GetAllCatalogues().Cast <IDeleteable>().Single().DeleteInDatabase();

            _lmd.DeleteInDatabase();

            _dir.Delete(true);
        }
        public ExecuteCommandAssociateCatalogueWithLoadMetadata(IActivateItems activator, LoadMetadata loadMetadata) : base(activator)
        {
            _loadMetadata = loadMetadata;

            _availableCatalogues = Activator.CoreChildProvider.AllCatalogues.Where(c => c.LoadMetadata_ID == null).ToArray();
            //Ensure logging task is correct
            _otherCatalogues = _loadMetadata.GetAllCatalogues().ToArray();

            if (!_availableCatalogues.Any())
            {
                SetImpossible("There are no Catalogues that are not associated with another Load already");
            }
        }
Example #5
0
        public void RefreshUIFromDatabase()
        {
            tlvLoadedTables.ClearObjects();

            if (_loadMetadata == null)
            {
                return;
            }

            TableInfo[] allTables;
            HICDatabaseConfiguration config;

            try
            {
                if (!_loadMetadata.GetAllCatalogues().Any())
                {
                    throw new Exception("There are no Catalogues (Datasets) associated with this LoadMetadata, choose one or more Catalogues by clicking 'Edit..' in LoadMetadataUI ");
                }

                allTables = _loadMetadata.GetDistinctTableInfoList(true).ToArray();
                config    = new HICDatabaseConfiguration(_loadMetadata);
            }
            catch (Exception e)
            {
                CommonFunctionality.Fatal("Could not fetch data", e);
                tlvLoadedTables.Visible = false;
                return;
            }
            tlvLoadedTables.Visible = true;

            _raw = new LoadDiagramServerNode(LoadBubble.Raw, config.DeployInfo[LoadBubble.Raw], allTables, config);
            var staging = new LoadDiagramServerNode(LoadBubble.Staging, config.DeployInfo[LoadBubble.Staging], allTables, config);
            var live    = new LoadDiagramServerNode(LoadBubble.Live, config.DeployInfo[LoadBubble.Live], allTables, config);

            tlvLoadedTables.AddObject(_raw);
            tlvLoadedTables.AddObject(staging);
            tlvLoadedTables.AddObject(live);

            //expand the servers
            foreach (var rootObject in tlvLoadedTables.Objects)
            {
                ExpandToDepth(2, rootObject);
            }

            loadStateUI1.SetStatus(LoadStateUI.LoadState.Unknown);
        }
Example #6
0
        public void SetupSuite(DiscoveredDatabase databaseToCreateInto, IRDMPPlatformRepositoryServiceLocator repositoryLocator, GlobalOptions globalOptions, Type pipelineDicomSourceType, string root = null, ImageTableTemplateCollection template = null, bool persistentRaw = false, string modalityPrefix = null)
        {
            ImageTable  = databaseToCreateInto.ExpectTable(modalityPrefix + "ImageTable");
            SeriesTable = databaseToCreateInto.ExpectTable(modalityPrefix + "SeriesTable");
            StudyTable  = databaseToCreateInto.ExpectTable(modalityPrefix + "StudyTable");

            try
            {
                File.Copy(typeof(InvalidDataHandling).Assembly.Location, Path.Combine(TestContext.CurrentContext.TestDirectory, "Rdmp.Dicom.dll"), true);
            }
            catch (System.IO.IOException)
            {
                //nevermind, it's probably locked
            }


            //The Rdmp.Dicom assembly should be loaded as a plugin, this simulates it.
            foreach (var type in typeof(InvalidDataHandling).Assembly.GetTypes())
            {
                repositoryLocator.CatalogueRepository.MEF.AddTypeToCatalogForTesting(type);
            }


            ICatalogueRepository  catalogueRepository  = repositoryLocator.CatalogueRepository;
            IDataExportRepository dataExportRepository = repositoryLocator.DataExportRepository;

            foreach (var t in new[] { ImageTable, SeriesTable, StudyTable })
            {
                if (t.Exists())
                {
                    t.Drop();
                }
            }

            var suite = new ExecuteCommandCreateNewImagingDatasetSuite(repositoryLocator, databaseToCreateInto, new DirectoryInfo(TestContext.CurrentContext.TestDirectory));

            suite.Template = template ?? GetDefaultTemplate(databaseToCreateInto.Server.DatabaseType);

            suite.PersistentRaw = persistentRaw;
            suite.TablePrefix   = modalityPrefix;

            suite.DicomSourceType = pipelineDicomSourceType;
            suite.CreateCoalescer = true;

            suite.Execute();
            DicomSourcePipelineComponent = suite.DicomSourcePipelineComponent; //store the component created so we can inject/adjust the arguments e.g. adding ElevationRequests to it

            LoadMetadata = suite.NewLoadMetadata;


            var tableInfos = LoadMetadata.GetAllCatalogues().SelectMany(c => c.GetTableInfoList(false)).Distinct().ToArray();

            ImageTableInfo  = (TableInfo)tableInfos.Single(t => t.GetRuntimeName().Equals(ImageTable.GetRuntimeName()));
            SeriesTableInfo = (TableInfo)tableInfos.Single(t => t.GetRuntimeName().Equals(SeriesTable.GetRuntimeName()));
            StudyTableInfo  = (TableInfo)tableInfos.Single(t => t.GetRuntimeName().Equals(StudyTable.GetRuntimeName()));

            // Override the options with stuff coming from Core RDMP DatabaseTests (TestDatabases.txt)
            globalOptions.FileSystemOptions.FileSystemRoot = root ?? TestContext.CurrentContext.TestDirectory;

            globalOptions.RDMPOptions.CatalogueConnectionString  = ((TableRepository)catalogueRepository).DiscoveredServer.Builder.ConnectionString;
            globalOptions.RDMPOptions.DataExportConnectionString = ((TableRepository)dataExportRepository).DiscoveredServer.Builder.ConnectionString;

            globalOptions.DicomRelationalMapperOptions.LoadMetadataId               = LoadMetadata.ID;
            globalOptions.DicomRelationalMapperOptions.MinimumBatchSize             = 1;
            globalOptions.DicomRelationalMapperOptions.UseInsertIntoForRAWMigration = true;

            //Image table now needs all the UIDs in order to be extractable
            var adder = new TagColumnAdder("StudyInstanceUID", "varchar(100)", ImageTableInfo, new AcceptAllCheckNotifier());

            adder.Execute();
        }