예제 #1
0
        protected override object[] GetRunnables()
        {
            lock (_oLock)
                ExtractCommands.Clear();

            var commands = new List <IExtractCommand>();

            //if we are extracting globals
            if (_options.ExtractGlobals)
            {
                var g       = _configuration.GetGlobals();
                var globals = new GlobalsBundle(g.OfType <SupportingDocument>().ToArray(), g.OfType <SupportingSQLTable>().ToArray());
                _globalsCommand = new ExtractGlobalsCommand(RepositoryLocator, _project, _configuration, globals);
                commands.Add(_globalsCommand);
            }

            var factory = new ExtractCommandCollectionFactory();

            foreach (ISelectedDataSets sds in GetSelectedDataSets())
            {
                var extractDatasetCommand = factory.Create(RepositoryLocator, sds);
                commands.Add(extractDatasetCommand);

                lock (_oLock)
                    ExtractCommands.Add(sds, extractDatasetCommand);
            }

            return(commands.ToArray());
        }
예제 #2
0
        /// <summary>
        /// Checks that all globals pass thier respective checkers (<see cref="SupportingSQLTableChecker"/> and <see cref="SupportingDocumentsFetcher"/>) and that
        /// the <see cref="Pipeline"/> (if any) is capable of extracting the globals.
        /// </summary>
        /// <param name="notifier"></param>
        public void Check(ICheckNotifier notifier)
        {
            foreach (SupportingSQLTable table in _configuration.GetGlobals().OfType <SupportingSQLTable>())
            {
                new SupportingSQLTableChecker(table).Check(notifier);
            }

            foreach (SupportingDocument document in _configuration.GetGlobals().OfType <SupportingDocument>())
            {
                new SupportingDocumentsFetcher(document).Check(notifier);
            }

            if (_alsoCheckPipeline != null && _command != null)
            {
                var engine = new ExtractionPipelineUseCase(_configuration.Project, _command, _alsoCheckPipeline, DataLoadInfo.Empty)
                             .GetEngine(_alsoCheckPipeline, new FromCheckNotifierToDataLoadEventListener(notifier));
                engine.Check(notifier);
            }
        }
예제 #3
0
        public override void SetDatabaseObject(IActivateItems activator, ExtractionConfiguration databaseObject)
        {
            base.SetDatabaseObject(activator, databaseObject);

            _extractionConfiguration = databaseObject;

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

            var checkedBefore = tlvDatasets.CheckedObjects;

            tlvDatasets.ClearObjects();

            _globals  = _extractionConfiguration.GetGlobals();
            _datasets = databaseObject.SelectedDataSets.ToArray();

            GetBundledStuff();

            //add the folders
            tlvDatasets.AddObjects(new object[] { _globalsFolder, _coreDatasetsFolder, _projectSpecificDatasetsFolder });

            //enable all to start with
            tlvDatasets.EnableObjects(tlvDatasets.Objects);

            tlvDatasets.DisableObjects(_globals);
            tlvDatasets.DisableObjects(_bundledStuff);

            //if there are no globals disable this option
            if (!_globals.Any())
            {
                tlvDatasets.DisableObject(_globalsFolder);
            }

            //if there are no project specific datasets
            if (_datasets.All(sds => sds.ExtractableDataSet.Project_ID == null))
            {
                tlvDatasets.DisableObject(_projectSpecificDatasetsFolder); //disable this option
            }
            //if all the datasets are project specific
            if (_datasets.All(sds => sds.ExtractableDataSet.Project_ID != null))
            {
                tlvDatasets.DisableObject(_coreDatasetsFolder);
            }

            //don't accept refresh while executing
            if (checkAndExecuteUI1.IsExecuting)
            {
                return;
            }

            if (_pipelineSelectionUI1 == null)
            {
                //create a new selection UI (pick an extraction pipeliene UI)
                var useCase = ExtractionPipelineUseCase.DesignTime();
                var factory = new PipelineSelectionUIFactory(Activator.RepositoryLocator.CatalogueRepository, null, useCase);

                _pipelineSelectionUI1 = factory.Create("Extraction Pipeline", DockStyle.Fill);
                _pipelineSelectionUI1.CollapseToSingleLineMode();

                //if the configuration has a default then use that pipeline
                if (_extractionConfiguration.DefaultPipeline_ID != null)
                {
                    _pipelineSelectionUI1.Pipeline = _extractionConfiguration.DefaultPipeline;
                }

                _pipelineSelectionUI1.PipelineChanged += ResetChecksUI;

                _pipelinePanel = new ToolStripControlHost((Control)_pipelineSelectionUI1);

                helpIcon1.SetHelpText("Extraction", "It is a wise idea to click here if you don't know what this screen can do for you...", BuildHelpFlow());
            }

            CommonFunctionality.Add(new ToolStripLabel("Extraction Pipeline:"));
            CommonFunctionality.Add(_pipelinePanel);
            CommonFunctionality.AddHelpStringToToolStrip("Extraction Pipeline", "The sequence of components that will be executed in order to enable the datasets to be extracted. This will start with a source component that performs the linkage against the cohort followed by subsequent components (if any) and then a destination component that writes the final records (e.g. to database / csv file etc).");

            CommonFunctionality.AddToMenu(new ExecuteCommandRelease(activator).SetTarget(_extractionConfiguration));

            CommonFunctionality.Add(lblMaxConcurrent);
            CommonFunctionality.Add(tbMaxConcurrent);
            CommonFunctionality.AddHelpStringToToolStrip("Concurrent", "The maximum number of datasets to extract at once.  Once this number is reached the remainder will be queued and only started when one of the other extracting datasets completes.");

            checkAndExecuteUI1.SetItemActivator(activator);

            tlvDatasets.ExpandAll();

            if (_isFirstTime)
            {
                tlvDatasets.CheckAll();
                foreach (var disabledObject in tlvDatasets.DisabledObjects.OfType <ArbitraryFolderNode>())
                {
                    tlvDatasets.UncheckObject(disabledObject);
                }
            }
            else if (checkedBefore.Count > 0)
            {
                tlvDatasets.CheckObjects(checkedBefore);
            }

            _isFirstTime = false;
        }