public void Find_CohortAggregateContainer_ByFreeText(bool userSetting)
        {
            var container = WhenIHaveA <CohortAggregateContainer>();

            container.Name = "All the trolls in the troll kingdom";

            UserSettings.ScoreZeroForCohortAggregateContainers = userSetting;

            var scorer = new SearchablesMatchScorer();

            scorer.TypeNames.Add("CohortAggregateContainer");

            var childProvider = new DataExportChildProvider(RepositoryLocator, null, new ThrowImmediatelyCheckNotifier(), null);

            // user is searching for the text 'troll'
            var scores = scorer.ScoreMatches(childProvider.GetAllSearchables(), "troll", CancellationToken.None, new List <Type>());

            var score = scores.Single(d => Equals(d.Key.Key, container));

            if (userSetting)
            {
                // although the text appears in the search they are not doing it by exact type name and their settings
                // mean they don't want to see these objects by default.
                Assert.AreEqual(0, score.Value);
            }
            else
            {
                Assert.Greater(score.Value, 0);
            }
        }
Beispiel #2
0
        private void UpdateChildProviders()
        {
            //prefer a linked repository with both
            if (RepositoryLocator.DataExportRepository != null)
            {
                try
                {
                    CoreChildProvider = new DataExportChildProvider(RepositoryLocator, PluginUserInterfaces.ToArray(), GlobalErrorCheckNotifier);
                }
                catch (Exception e)
                {
                    ExceptionViewer.Show(e);
                }
            }

            //there was an error generating a data export repository or there was no repository specified

            //so just create a catalogue one
            if (CoreChildProvider == null)
            {
                CoreChildProvider = new CatalogueChildProvider(RepositoryLocator.CatalogueRepository, PluginUserInterfaces.ToArray(), GlobalErrorCheckNotifier);
            }


            CoreChildProvider.GetPluginChildren();
            RefreshBus.ChildProvider = CoreChildProvider;
        }
Beispiel #3
0
        public TestActivateItems(UITests uiTests, MemoryDataExportRepository repo) : base(new RepositoryProvider(repo), new ToMemoryCheckNotifier())
        {
            _uiTests   = uiTests;
            Results    = new TestActivateItemsResults();
            RefreshBus = new RefreshBus();

            //don't load the comment store for every single test
            if (_commentStore == null)
            {
                _commentStore = new CommentStore();
                _commentStore.ReadComments(TestContext.CurrentContext.TestDirectory);
            }

            CommentStore = _commentStore;

            CoreChildProvider  = new DataExportChildProvider(RepositoryLocator, null, Results);
            CoreIconProvider   = new DataExportIconProvider(RepositoryLocator, null);
            FavouritesProvider = new FavouritesProvider(this, repo.CatalogueRepository);

            _problemProviders = new List <IProblemProvider>(new IProblemProvider[]
            {
                new CatalogueProblemProvider(),
                new DataExportProblemProvider()
            });

            PluginUserInterfaces = new List <IPluginUserInterface>();
        }
        private void TestScoringFlag(Action <Catalogue, ExtractableDataSet> setter, bool expectedResult)
        {
            // Filter is hungry and eager to please.  If you want to see ProjectSpecific Catalogues then
            // that it will show you them regardless of other settings.  Likewise clicking Deprecated shows
            // all deprecated catalogues regardless of other settings.
            //
            // So set all to false to except the condition we are testing
            UserSettings.ShowDeprecatedCatalogues      = false;
            UserSettings.ShowNonExtractableCatalogues  = false;
            UserSettings.ShowProjectSpecificCatalogues = false;
            UserSettings.ShowInternalCatalogues        = false;
            UserSettings.ShowColdStorageCatalogues     = false;

            var c = WhenIHaveA <Catalogue>();

            c.Name = "Bunny";
            c.SaveToDatabase();

            // this makes c extractable (the usual case for Catalogues)
            var eds = new ExtractableDataSet(Repository, c);

            eds.SaveToDatabase();

            setter(c, eds);
            c.SaveToDatabase();


            var scorer = new SearchablesMatchScorer()
            {
                RespectUserSettings = true
            };

            var childProvider = new DataExportChildProvider(RepositoryLocator, null, new ThrowImmediatelyCheckNotifier(), null);

            // user is searching for the text 'troll'
            var scores = scorer.ScoreMatches(childProvider.GetAllSearchables(), "Bunny", CancellationToken.None, new List <Type>());

            var score = scores.Single(d => Equals(d.Key.Key, c));

            if (expectedResult)
            {
                Assert.Greater(score.Value, 0);
            }
            else
            {
                // score 0 and don't be included in results
                Assert.AreEqual(0, score.Value);
            }

            // Cleanup test
            foreach (var d in Repository.GetAllObjects <ExtractableDataSet>())
            {
                d.DeleteInDatabase();
            }
            foreach (var cat in Repository.GetAllObjects <Catalogue>())
            {
                cat.DeleteInDatabase();
            }
        }
Beispiel #5
0
        public void TestUpTo()
        {
            string[] skip = { "AllAggregateContainers", "_dataExportFilterManager", "dataExportRepository", "WriteLock", "_oProjectNumberToCohortsDictionary", "_errorsCheckNotifier" };

            // We have 2 providers and want to suck all the data out of one into the other
            var cp1 = new DataExportChildProvider(RepositoryLocator, null, new ThrowImmediatelyCheckNotifier(), null);
            var cp2 = new DataExportChildProvider(RepositoryLocator, null, new ThrowImmediatelyCheckNotifier(), null);

            //to start with lets make sure all fields and properties are different on the two classes except where we expect them to be the same
            BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;

            foreach (var prop in typeof(DataExportChildProvider).GetProperties().Where(p => !skip.Contains(p.Name)))
            {
                Assert.AreNotSame(prop.GetValue(cp1), prop.GetValue(cp2), $"Prop {prop} was unexpectedly the same between child providers");
            }

            foreach (var field in typeof(DataExportChildProvider).GetFields(bindFlags).Where(p => !skip.Contains(p.Name)))
            {
                Assert.AreNotSame(field.GetValue(cp1), field.GetValue(cp2), $"Field {field} was unexpectedly the same between child providers");
            }

            // Now call UpdateTo to make cp1 look like cp2
            cp1.UpdateTo(cp2);

            List <string> badProps = new List <string>();

            foreach (var prop in typeof(DataExportChildProvider).GetProperties().Where(p => !skip.Contains(p.Name)))
            {
                try
                {
                    Assert.AreSame(prop.GetValue(cp1), prop.GetValue(cp2), $"Prop {prop} was not the same between child providers - after UpdateTo");
                }
                catch (Exception)
                {
                    badProps.Add(prop.Name);
                }
            }

            Assert.IsEmpty(badProps);

            List <string> badFields = new List <string>();

            foreach (var field in typeof(DataExportChildProvider).GetFields(bindFlags).Where(p => !skip.Contains(p.Name)))
            {
                try
                {
                    Assert.AreSame(field.GetValue(cp1), field.GetValue(cp2), $"Field {field} was not the same between child providers - after UpdateTo");
                }
                catch (Exception)
                {
                    badFields.Add(field.Name);
                }
            }

            Assert.IsEmpty(badFields);
        }
        public ExtractionConfigurationMenu(RDMPContextMenuStripArgs args, ExtractionConfiguration extractionConfiguration)
            : base(args, extractionConfiguration)
        {
            _extractionConfiguration = extractionConfiguration;
            _childProvider           = (DataExportChildProvider)_activator.CoreChildProvider;

            _datasets = _childProvider.GetDatasets(extractionConfiguration).Select(n => n.ExtractableDataSet).ToArray();

            Items.Add("Edit", null, (s, e) => _activator.Activate <ExtractionConfigurationUI, ExtractionConfiguration>(extractionConfiguration));

            _importableDataSets = _childProvider.ExtractableDataSets.Except(_datasets).Where(ds => ds.Project_ID == null || ds.Project_ID == extractionConfiguration.Project_ID).ToArray();

            ///////////////////Change Cohorts//////////////

            Add(new ExecuteCommandRelease(_activator).SetTarget(extractionConfiguration));

            Add(new ExecuteCommandChooseCohort(_activator, extractionConfiguration));

            /////////////////Add Datasets/////////////
            var addDataSets = new ToolStripMenuItem("Add DataSet(s)", _activator.CoreIconProvider.GetImage(RDMPConcept.ExtractableDataSet, OverlayKind.Link), (s, e) => AddDatasetsToConfiguration());

            addDataSets.Enabled = !extractionConfiguration.IsReleased && _importableDataSets.Any();//not frozen and must be at least 1 dataset that is not in the configuration!
            Items.Add(addDataSets);

            if (_childProvider.AllPackages.Any())
            {
                var addPackageMenuItem = new ToolStripMenuItem("Add DataSet Package", _activator.CoreIconProvider.GetImage(RDMPConcept.ExtractableDataSetPackage));
                foreach (ExtractableDataSetPackage package in _childProvider.AllPackages)
                {
                    ExtractableDataSetPackage package1 = package;
                    addPackageMenuItem.DropDownItems.Add(package.Name, null, (s, e) => AddPackageToConfiguration(package1));
                }
                addPackageMenuItem.Enabled = !extractionConfiguration.IsReleased && _importableDataSets.Any();//not frozen and must be at least 1 dataset that is not in the configuration!
                Items.Add(addPackageMenuItem);
            }

            Add(new ExecuteCommandGenerateReleaseDocument(_activator, extractionConfiguration));

            var freeze = new ToolStripMenuItem("Freeze Extraction", CatalogueIcons.FrozenExtractionConfiguration, (s, e) => Freeze());

            freeze.Enabled = !extractionConfiguration.IsReleased && _datasets.Any();
            Items.Add(freeze);

            if (extractionConfiguration.IsReleased)
            {
                Add(new ExecuteCommandUnfreezeExtractionConfiguration(_activator, extractionConfiguration));
            }

            Add(new ExecuteCommandCloneExtractionConfiguration(_activator, extractionConfiguration));

            Add(new ExecuteCommandRefreshExtractionConfigurationsCohort(_activator, extractionConfiguration));

            ReBrandActivateAs("Extract...", RDMPConcept.ExtractionConfiguration, OverlayKind.Execute);
        }
Beispiel #7
0
 private void RefreshChildProvider()
 {
     //todo pass the plugin child providers
     if (RepositoryLocator.DataExportRepository != null)
     {
         CoreChildProvider = new DataExportChildProvider(RepositoryLocator, null, new ThrowImmediatelyCheckNotifier());
     }
     else
     {
         CoreChildProvider = new CatalogueChildProvider(RepositoryLocator.CatalogueRepository, null, new ThrowImmediatelyCheckNotifier());
     }
 }
        public void TestOrphanCic()
        {
            var memory = new MemoryDataExportRepository();
            var cic    = new CohortIdentificationConfiguration(memory, "Mycic");
            var p      = new Project(memory, "my proj");

            p.AssociateWithCohortIdentification(cic);

            //fetch the instance
            var cicAssoc = memory.GetAllObjects <ProjectCohortIdentificationConfigurationAssociation>().Single();

            //relationship from p should resolve to the association link
            Assert.AreEqual(cicAssoc, p.ProjectCohortIdentificationConfigurationAssociations[0]);

            //relationship from p should resolve to the cic
            Assert.AreEqual(cic, p.GetAssociatedCohortIdentificationConfigurations()[0]);

            //in order to make it an orphan we have to suppress the system default behaviour of cascading across the deletion
            var obscure = memory.ObscureDependencyFinder as CatalogueObscureDependencyFinder;

            if (obscure != null)
            {
                obscure.OtherDependencyFinders.Clear();
            }

            //make the assoc an orphan
            cic.DeleteInDatabase();
            cicAssoc.ClearAllInjections();

            //assoc should still exist
            Assert.AreEqual(cicAssoc, p.ProjectCohortIdentificationConfigurationAssociations[0]);
            Assert.IsNull(p.ProjectCohortIdentificationConfigurationAssociations[0].CohortIdentificationConfiguration);

            //relationship from p should resolve to the cic
            Assert.IsEmpty(p.GetAssociatedCohortIdentificationConfigurations());

            //error should be reported in top right of program
            var ex = Assert.Throws <Exception>(() => new DataExportChildProvider(new RepositoryProvider(memory), null, new ThrowImmediatelyCheckNotifier(), null));

            StringAssert.IsMatch(@"Failed to find Associated Cohort Identification Configuration with ID \d+ which was supposed to be associated with my proj", ex.Message);

            //but UI should still respond
            var childProvider = new DataExportChildProvider(new RepositoryProvider(memory), null, new IgnoreAllErrorsCheckNotifier(), null);

            //the orphan cic should not appear in the tree view under Project=>Cohorts=>Associated Cics
            var cohorts = childProvider.GetChildren(p).OfType <ProjectCohortsNode>().Single();
            var cics    = childProvider.GetChildren(cohorts).OfType <ProjectCohortIdentificationConfigurationAssociationsNode>().First();

            Assert.IsEmpty(childProvider.GetChildren(cics));
        }
Beispiel #9
0
        protected override ICoreChildProvider GetChildProvider()
        {
            //constructor call in base class
            if (PluginUserInterfaces == null)
            {
                return(null);
            }

            //Dispose the old one
            ICoreChildProvider temp = null;

            //prefer a linked repository with both
            if (RepositoryLocator.DataExportRepository != null)
            {
                try
                {
                    temp = new DataExportChildProvider(RepositoryLocator, PluginUserInterfaces.ToArray(), GlobalErrorCheckNotifier, CoreChildProvider as DataExportChildProvider);
                }
                catch (Exception e)
                {
                    ExceptionViewer.Show(e);
                }
            }

            //there was an error generating a data export repository or there was no repository specified

            //so just create a catalogue one
            if (temp == null)
            {
                temp = new CatalogueChildProvider(RepositoryLocator.CatalogueRepository, PluginUserInterfaces.ToArray(), GlobalErrorCheckNotifier, CoreChildProvider as CatalogueChildProvider);
            }

            // first time
            if (CoreChildProvider == null)
            {
                CoreChildProvider = temp;
            }
            else
            {
                CoreChildProvider.UpdateTo(temp);
            }

            return(CoreChildProvider);
        }
Beispiel #10
0
        public ExecuteCommandChooseCohort(IBasicActivateItems activator, ExtractionConfiguration extractionConfiguration) : base(activator)
        {
            _extractionConfiguration = extractionConfiguration;

            var project = _extractionConfiguration.Project;

            if (extractionConfiguration.IsReleased)
            {
                SetImpossible("ExtractionConfiguration has already been released");
                return;
            }

            if (!project.ProjectNumber.HasValue)
            {
                SetImpossible("Project does not have a ProjectNumber, this determines which cohorts are eligible");
                return;
            }

            _childProvider = BasicActivator.CoreChildProvider as DataExportChildProvider;

            if (_childProvider == null)
            {
                SetImpossible("Activator.CoreChildProvider is not an DataExportChildProvider");
                return;
            }

            //find cohorts that match the project number
            if (_childProvider.ProjectNumberToCohortsDictionary.ContainsKey(project.ProjectNumber.Value))
            {
                _compatibleCohorts = (_childProvider.ProjectNumberToCohortsDictionary[project.ProjectNumber.Value]).ToList();
            }

            //if theres only one compatible cohort and that one is already selected
            if (_compatibleCohorts.Count == 1 && _compatibleCohorts.Single().ID == _extractionConfiguration.Cohort_ID)
            {
                SetImpossible("The currently select cohort is the only one available");
            }

            if (!_compatibleCohorts.Any())
            {
                SetImpossible("There are no cohorts currently configured with ProjectNumber " + project.ProjectNumber.Value);
            }
        }
        public void Find_CohortAggregateContainer_ByTypeName(bool userSetting)
        {
            var container = WhenIHaveA <CohortAggregateContainer>();

            UserSettings.ScoreZeroForCohortAggregateContainers = userSetting;

            var scorer = new SearchablesMatchScorer();

            scorer.TypeNames.Add("CohortAggregateContainer");

            var childProvider = new DataExportChildProvider(RepositoryLocator, null, new ThrowImmediatelyCheckNotifier(), null);

            var scores = scorer.ScoreMatches(childProvider.GetAllSearchables(), "", CancellationToken.None, new List <Type>()
            {
                typeof(CohortAggregateContainer)
            });

            var score = scores.Single(d => Equals(d.Key.Key, container));

            Assert.Greater(score.Value, 0);
        }
Beispiel #12
0
        protected virtual ICoreChildProvider GetChildProvider()
        {
            // Build new CoreChildProvider in a temp then update to it to avoid stale references
            ICoreChildProvider temp = null;

            //prefer a linked repository with both
            if (RepositoryLocator.DataExportRepository != null)
            {
                try
                {
                    temp = new DataExportChildProvider(RepositoryLocator, PluginUserInterfaces.ToArray(), GlobalErrorCheckNotifier, CoreChildProvider as DataExportChildProvider);
                }
                catch (Exception e)
                {
                    ShowException("Error constructing DataExportChildProvider", e);
                }
            }

            //there was an error generating a data export repository or there was no repository specified

            //so just create a catalogue one
            if (temp == null)
            {
                temp = new CatalogueChildProvider(RepositoryLocator.CatalogueRepository, PluginUserInterfaces.ToArray(), GlobalErrorCheckNotifier, CoreChildProvider as CatalogueChildProvider);
            }

            // first time
            if (CoreChildProvider == null)
            {
                CoreChildProvider = temp;
            }
            else
            {
                CoreChildProvider.UpdateTo(temp);
            }

            return(CoreChildProvider);
        }
        public ExtractionConfigurationMenu(RDMPContextMenuStripArgs args, ExtractionConfiguration extractionConfiguration)
            : base(args, extractionConfiguration)
        {
            _extractionConfiguration = extractionConfiguration;
            _childProvider           = (DataExportChildProvider)_activator.CoreChildProvider;



            Items.Add("Edit", null, (s, e) => _activator.Activate <ExtractionConfigurationUI, ExtractionConfiguration>(extractionConfiguration));

            ///////////////////Change Cohorts//////////////

            Add(new ExecuteCommandRelease(_activator).SetTarget(extractionConfiguration));

            Add(new ExecuteCommandChooseCohort(_activator, extractionConfiguration));

            /////////////////Add Datasets/////////////
            Add(new ExecuteCommandAddDatasetsToConfiguration(_activator, extractionConfiguration));

            Add(new ExecuteCommandAddPackageToConfiguration(_activator, extractionConfiguration));

            Add(new ExecuteCommandGenerateReleaseDocument(_activator, extractionConfiguration));

            if (extractionConfiguration.IsReleased)
            {
                Add(new ExecuteCommandUnfreezeExtractionConfiguration(_activator, extractionConfiguration));
            }
            else
            {
                Add(new ExecuteCommandFreezeExtractionConfiguration(_activator, extractionConfiguration));
            }

            Add(new ExecuteCommandCloneExtractionConfiguration(_activator, extractionConfiguration));

            Add(new ExecuteCommandRefreshExtractionConfigurationsCohort(_activator, extractionConfiguration));

            ReBrandActivateAs("Extract...", RDMPConcept.ExtractionConfiguration, OverlayKind.Execute);
        }
        public void Find_ExactMatch_ScoresHigher()
        {
            var cata = WhenIHaveA <Catalogue>();

            cata.Name = "FF";
            var proj = WhenIHaveA <Project>();

            proj.Name = "FFFF";

            var scorer = new SearchablesMatchScorer();

            var childProvider = new DataExportChildProvider(RepositoryLocator, null, new ThrowImmediatelyCheckNotifier(), null);
            var scores        = scorer.ScoreMatches(childProvider.GetAllSearchables(), "FF", CancellationToken.None, new List <Type>());

            var cataScore = scores.Single(d => Equals(d.Key.Key, cata));
            var projScore = scores.Single(d => Equals(d.Key.Key, proj));

            // Both score because they have the text FF
            Assert.Greater(cataScore.Value, 0);
            Assert.Greater(projScore.Value, 0);

            // Catalogue scores higher because it is an exact match to the name
            Assert.Greater(cataScore.Value, projScore.Value);
        }
Beispiel #15
0
 public override void Publish(DatabaseEntity databaseEntity)
 {
     //refresh the child provider because there could be new objects
     CoreChildProvider = new DataExportChildProvider(RepositoryLocator, null, GlobalErrorCheckNotifier);
 }
Beispiel #16
0
 public ConsoleGuiActivator(IRDMPPlatformRepositoryServiceLocator repositoryLocator, ICheckNotifier globalErrorCheckNotifier) : base(repositoryLocator, globalErrorCheckNotifier)
 {
     CoreChildProvider = new DataExportChildProvider(RepositoryLocator, null, GlobalErrorCheckNotifier);
 }
Beispiel #17
0
        public void TestActuallyCreatingIt(DatabaseType type)
        {
            var db = GetCleanedServer(type);

            CreateNewCohortDatabaseWizard wizard = new CreateNewCohortDatabaseWizard(db, CatalogueRepository, DataExportRepository, false);

            _extractionInfo2.IsExtractionIdentifier = true;
            _extractionInfo2.SaveToDatabase();

            var candidate = wizard.GetPrivateIdentifierCandidates().Single(c => c.RuntimeName.Equals("PrivateIdentifierB"));
            var ect       = wizard.CreateDatabase(
                candidate,
                new ThrowImmediatelyCheckNotifier());

            Assert.AreEqual(type, ect.DatabaseType);

            //database should exist
            DiscoveredServerICanCreateRandomDatabasesAndTablesOn.ExpectDatabase(cohortDatabaseName);
            Assert.IsTrue(db.Exists());

            //did it create the correct type?
            Assert.AreEqual(type, ect.DatabaseType);

            //the ExternalCohortTable should pass tests
            ect.Check(new ThrowImmediatelyCheckNotifier());

            //now try putting someone in it
            //the project it will go under
            var project = new Project(DataExportRepository, "MyProject");

            project.ProjectNumber = 10;
            project.SaveToDatabase();

            //the request to put it under there
            var request = new CohortCreationRequest(project, new CohortDefinition(null, "My cohort", 1, 10, ect), DataExportRepository, "Blah");

            //the actual cohort data
            DataTable dt = new DataTable();

            dt.Columns.Add(_extractionInfo2.GetRuntimeName());
            dt.Rows.Add(101243); //_extractionInfo2 is of type int

            //the destination component that will put it there
            var dest = new BasicCohortDestination();

            dest.PreInitialize(request, new ThrowImmediatelyDataLoadEventListener());

            //tell it to use the guid allocator
            dest.ReleaseIdentifierAllocator = typeof(GuidReleaseIdentifierAllocator);

            dest.ProcessPipelineData(dt, new ThrowImmediatelyDataLoadEventListener(), new GracefulCancellationToken());
            dest.Dispose(new ThrowImmediatelyDataLoadEventListener(), null);

            var cohort = request.CohortCreatedIfAny;

            Assert.IsNotNull(cohort);

            var externalData = cohort.GetExternalData();

            Assert.AreEqual(10, externalData.ExternalProjectNumber);
            Assert.IsFalse(string.IsNullOrEmpty(externalData.ExternalDescription));


            Assert.AreEqual(DateTime.Now.Year, externalData.ExternalCohortCreationDate.Value.Year);
            Assert.AreEqual(DateTime.Now.Month, externalData.ExternalCohortCreationDate.Value.Month);
            Assert.AreEqual(DateTime.Now.Day, externalData.ExternalCohortCreationDate.Value.Day);
            Assert.AreEqual(DateTime.Now.Hour, externalData.ExternalCohortCreationDate.Value.Hour);

            cohort.AppendToAuditLog("Test");

            Assert.IsTrue(cohort.AuditLog.Contains("Test"));

            Assert.AreEqual(1, cohort.Count);
            Assert.AreEqual(1, cohort.CountDistinct);

            var cohortTable = cohort.FetchEntireCohort();

            Assert.AreEqual(1, cohortTable.Rows.Count);

            var helper = ect.GetQuerySyntaxHelper();

            Assert.AreEqual(101243, cohortTable.Rows[0][helper.GetRuntimeName(ect.PrivateIdentifierField)]);
            var aguid = cohortTable.Rows[0][helper.GetRuntimeName(ect.ReleaseIdentifierField)].ToString();

            Assert.IsFalse(string.IsNullOrWhiteSpace(aguid)); //should be a guid

            //test reversing the anonymisation of something
            var dtAno = new DataTable();

            dtAno.Columns.Add(cohort.GetReleaseIdentifier(true));
            dtAno.Columns.Add("Age");
            dtAno.Rows.Add(aguid, 23);
            dtAno.Rows.Add(aguid, 99);

            cohort.ReverseAnonymiseDataTable(dtAno, new ThrowImmediatelyDataLoadEventListener(), true);

            Assert.AreEqual(2, dtAno.Columns.Count);
            Assert.IsTrue(dtAno.Columns.Contains(cohort.GetPrivateIdentifier(true)));

            Assert.AreEqual("101243", dtAno.Rows[0][cohort.GetPrivateIdentifier(true)]);
            Assert.AreEqual("101243", dtAno.Rows[1][cohort.GetPrivateIdentifier(true)]);

            //make sure that it shows up in the child provider (provides fast object access in CLI and builds tree model for UI)
            var repo        = new DataExportChildProvider(RepositoryLocator, null, new ThrowImmediatelyCheckNotifier(), null);
            var descendancy = repo.GetDescendancyListIfAnyFor(cohort);

            Assert.IsNotNull(descendancy);
        }
Beispiel #18
0
        public override void SetDatabaseObject(IActivateItems activator, Project databaseObject)
        {
            base.SetDatabaseObject(activator, databaseObject);

            if (!_commonFunctionality.IsSetup)
            {
                _commonFunctionality.SetUp(RDMPCollection.None, tlvReleasePotentials, Activator, olvName, null, new RDMPCollectionCommonFunctionalitySettings
                {
                    AddFavouriteColumn    = false,
                    AllowPinning          = false,
                    SuppressChildrenAdder = true,
                    AddCheckColumn        = false
                });
            }

            _childProvider = (DataExportChildProvider)Activator.CoreChildProvider;
            _project       = databaseObject;

            //figure out the globals
            var ec = _project.ExtractionConfigurations.FirstOrDefault();

            _globals = ec != null?ec.GetGlobals() : new IMapsDirectlyToDatabaseTable[0];

            if (_pipelineSelectionUI1 == null)
            {
                var context = ReleaseUseCase.DesignTime();
                _pipelineSelectionUI1 = new PipelineSelectionUIFactory(Activator.RepositoryLocator.CatalogueRepository, null, context).Create(Activator, "Release", DockStyle.Fill);
                _pipelineSelectionUI1.CollapseToSingleLineMode();
                _pipelineSelectionUI1.Pipeline         = null;
                _pipelineSelectionUI1.PipelineChanged += ResetChecksUI;

                _pipelinePanel = new ToolStripControlHost((Control)_pipelineSelectionUI1);
            }

            CommonFunctionality.Add(new ToolStripLabel("Release Pipeline:"));
            CommonFunctionality.Add(_pipelinePanel);
            CommonFunctionality.AddHelpStringToToolStrip("Release Pipeline", "The sequence of components that will be executed in order to gather the extracted artifacts and assemble them into a single release folder/database. This will start with a source component that gathers the artifacts (from wherever they were extracted to) followed by subsequent components (if any) and then a destination component that generates the final releasable file/folder.");

            checkAndExecuteUI1.SetItemActivator(activator);

            var checkedBefore = tlvReleasePotentials.CheckedObjects;

            tlvReleasePotentials.ClearObjects();
            tlvReleasePotentials.AddObject(_globalsNode);
            tlvReleasePotentials.AddObject(_project);
            tlvReleasePotentials.ExpandAll();

            if (_isFirstTime)
            {
                tlvReleasePotentials.CheckAll();
            }
            else if (checkedBefore.Count > 0)
            {
                tlvReleasePotentials.CheckObjects(checkedBefore);
            }

            _isFirstTime = false;

            tlvReleasePotentials.DisableObjects(_globals);
            //tlvReleasePotentials.DisableObject(_globalsNode);
        }
Beispiel #19
0
        /// <summary>
        /// Fetches all containers and filters out of the <paramref name="repository"/> and sets the class up to provide
        /// fast access to them.
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="childProvider"></param>
        public DataExportFilterManagerFromChildProvider(DataExportRepository repository, DataExportChildProvider childProvider) : base(repository)
        {
            _containersToFilters = childProvider.AllDeployedExtractionFilters.Where(f => f.FilterContainer_ID.HasValue).GroupBy(f => f.FilterContainer_ID.Value).ToDictionary(gdc => gdc.Key, gdc => gdc.ToList());

            var server = repository.DiscoveredServer;

            using (var con = repository.GetConnection())
            {
                var r = server.GetCommand("SELECT *  FROM FilterContainerSubcontainers", con).ExecuteReader();
                while (r.Read())
                {
                    var parentId       = Convert.ToInt32(r["FilterContainer_ParentID"]);
                    var subcontainerId = Convert.ToInt32(r["FilterContainerChildID"]);

                    if (!_subcontainers.ContainsKey(parentId))
                    {
                        _subcontainers.Add(parentId, new List <FilterContainer>());
                    }

                    _subcontainers[parentId].Add(childProvider.AllContainers[subcontainerId]);
                }
                r.Close();
            }
        }
 public ExtractableDataSetPackageMenu(RDMPContextMenuStripArgs args, ExtractableDataSetPackage package) : base(args, package)
 {
     _package       = package;
     _childProvider = (DataExportChildProvider)_activator.CoreChildProvider;
     Items.Add("Add ExtractableDataSet(s) to Package", _activator.CoreIconProvider.GetImage(RDMPConcept.ExtractableDataSet, OverlayKind.Link), AddExtractableDatasetToPackage);
 }