Esempio n. 1
0
 /// <summary>
 /// prepares to check the dataset as it is selected in an <see cref="ExtractionConfiguration"/>.  Optionally checks an extraction <see cref="Pipeline"/> and globals
 /// </summary>
 /// <param name="activator"></param>
 /// <param name="selectedDataSet"></param>
 /// <param name="checkGlobals"></param>
 /// <param name="alsoCheckPipeline"></param>
 public SelectedDataSetsChecker(IBasicActivateItems activator, ISelectedDataSets selectedDataSet, bool checkGlobals = false, IPipeline alsoCheckPipeline = null)
 {
     _checkGlobals      = checkGlobals;
     _alsoCheckPipeline = alsoCheckPipeline;
     _activator         = activator;
     SelectedDataSet    = selectedDataSet;
 }
Esempio n. 2
0
        public object GetState(ISelectedDataSets selectedDataSets)
        {
            var matches = GetCheckerResults <ReleasePotential>(rp => rp.SelectedDataSet.ID == selectedDataSets.ID);

            if (matches.Length == 0)
            {
                return(null);
            }

            var releasePotential = (ReleasePotential)matches.Single().Key;
            var results          = matches.Single().Value;

            //not been released ever
            if (releasePotential is NoReleasePotential)
            {
                return(Releaseability.NeverBeenSuccessfullyExecuted);
            }

            //do we know the release state of the assesments
            if (releasePotential.Assessments != null && releasePotential.Assessments.Any())
            {
                var releasability = releasePotential.Assessments.Values.Min();

                if (releasability != Releaseability.Undefined)
                {
                    return(releasability);
                }
            }

            //otherwise use the checks of it
            return(results.GetWorst());
        }
Esempio n. 3
0
        public ExecuteCommandOpenExtractionDirectory(IActivateItems activator, ISelectedDataSets sds) : base(activator)
        {
            var result = sds.GetCumulativeExtractionResultsIfAny();

            try
            {
                if (result == null)
                {
                    SetImpossible("Dataset has not been extracted");
                }
                else
                if (result.DestinationType == null || !result.DestinationType.EndsWith("FlatFileDestination"))
                {
                    SetImpossible("Extraction destination was not to disk");
                }
                else
                {
                    _file = new FileInfo(result.DestinationDescription);

                    if (!_file.Exists)
                    {
                        SetImpossible($"File '{_file.FullName}' did not exist on disk");
                    }
                }
            }
            catch (Exception)
            {
                SetImpossible("Could not determine file location");
            }
        }
Esempio n. 4
0
        protected ReleasePotential(IRDMPPlatformRepositoryServiceLocator repositoryLocator, ISelectedDataSets selectedDataSet)
        {
            _repositoryLocator = repositoryLocator;
            _repository        = selectedDataSet.Repository;
            SelectedDataSet    = selectedDataSet;
            Configuration      = selectedDataSet.ExtractionConfiguration;
            DataSet            = selectedDataSet.ExtractableDataSet;
            Assessments        = new Dictionary <IExtractionResults, Releaseability>();

            //see what has been extracted before
            DatasetExtractionResult = Configuration.CumulativeExtractionResults.FirstOrDefault(r => r.ExtractableDataSet_ID == DataSet.ID);
        }
Esempio n. 5
0
        private void AddClearTarget(ISelectedDataSets sds)
        {
            var progress = sds.ExtractionProgressIfAny;

            if (progress == null)
            {
                return;
            }

            if (progress.ProgressDate != null)
            {
                _toClear.Add(progress);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Sets the thing being released, valid targets are <see cref="Project"/>, <see cref="ExtractionConfiguration"/> and <see cref="ISelectedDataSets"/>.
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public IAtomicCommandWithTarget SetTarget(DatabaseEntity target)
        {
            _project         = target as Project;
            _configuration   = target as ExtractionConfiguration;
            _selectedDataSet = target as ISelectedDataSets;

            if (_project != null && _project.ExtractionConfigurations.All(ec => ec.IsReleased))
            {
                SetImpossible("There are no unreleased ExtractionConfigurations in Project");
            }

            if (_configuration != null)
            {
                _project = (Project)_configuration.Project;

                if (_configuration.IsReleased)
                {
                    SetImpossible("ExtractionConfiguration has already been Released");
                }

                if (_configuration.Cohort_ID == null)
                {
                    SetImpossible("No Cohort Defined");
                }

                if (!_configuration.SelectedDataSets.Any())
                {
                    SetImpossible("No datasets configured");
                }
            }
            if (_selectedDataSet != null)
            {
                _configuration = (ExtractionConfiguration)_selectedDataSet.ExtractionConfiguration;
                _project       = (Project)_configuration.Project;

                if (_selectedDataSet.ExtractionConfiguration.IsReleased)
                {
                    SetImpossible("This dataset is part of an ExtractionConfiguration that has already been Released");
                }

                if (_selectedDataSet.ExtractionConfiguration.Cohort_ID == null)
                {
                    SetImpossible("This dataset is part of an ExtractionConfiguration with no Cohort defined");
                }
            }

            return(this);
        }
Esempio n. 7
0
        public override void Execute()
        {
            base.Execute();

            if (_selectedDataSet == null && _extractionConfiguration != null)
            {
                _selectedDataSet = SelectOne(BasicActivator.RepositoryLocator.DataExportRepository.GetAllObjectsWithParent <SelectedDataSets>(_extractionConfiguration));
            }

            if (_selectedDataSet == null)
            {
                return;
            }

            BasicActivator.ShowData(new ViewSelectedDatasetExtractionUICollection(_selectedDataSet));
        }
Esempio n. 8
0
        public ExecuteCommandAddExtractionProgress(IBasicActivateItems activator, ISelectedDataSets sds) : base(activator)
        {
            _sds = sds;

            if (_sds.ExtractionProgressIfAny != null)
            {
                SetImpossible("Catalogue already has an ExtractionProgress");
                return;
            }

            if (_sds.GetCatalogue()?.TimeCoverage_ExtractionInformation_ID == null)
            {
                SetImpossible("Catalogue does not have a time coverage field configured");
                return;
            }
        }
Esempio n. 9
0
        public IAtomicCommandWithTarget SetTarget(DatabaseEntity target)
        {
            if (target is SelectedDataSets)
            {
                _selectedDataSet = target as SelectedDataSets;

                if (_selectedDataSet != null)
                {
                    //must have datasets and have a cohort configured
                    if (_selectedDataSet.ExtractionConfiguration.Cohort_ID == null)
                    {
                        SetImpossible("No cohort has been selected for ExtractionConfiguration");
                    }
                }
            }

            if (target is ExtractionConfiguration)
            {
                _extractionConfiguration = target as ExtractionConfiguration;
            }

            return(this);
        }
Esempio n. 10
0
 /// <inheritdoc/>
 public abstract ReleasePotential GetReleasePotential(IRDMPPlatformRepositoryServiceLocator repositoryLocator, ISelectedDataSets selectedDataSet);
Esempio n. 11
0
 /// <summary>
 /// prepares to check the dataset as it is selected in an <see cref="ExtractionConfiguration"/>.  Optionally checks an extraction <see cref="Pipeline"/> and globals
 /// </summary>
 /// <param name="selectedDataSet"></param>
 /// <param name="checkGlobals"></param>
 /// <param name="alsoCheckPipeline"></param>
 public SelectedDataSetsChecker(ISelectedDataSets selectedDataSet, bool checkGlobals = false, IPipeline alsoCheckPipeline = null)
 {
     _checkGlobals      = checkGlobals;
     _alsoCheckPipeline = alsoCheckPipeline;
     SelectedDataSet    = selectedDataSet;
 }
Esempio n. 12
0
 public ExtractDatasetCommand Create(IRDMPPlatformRepositoryServiceLocator repositoryLocator, ISelectedDataSets selectedDataSets)
 {
     return(CreateDatasetCommand(repositoryLocator, selectedDataSets.ExtractableDataSet, selectedDataSets.ExtractionConfiguration));
 }
Esempio n. 13
0
 private bool IsEligible(ISelectedDataSets arg)
 {
     return(arg.RootFilterContainer_ID != null);
 }
Esempio n. 14
0
 /// <inheritdoc/>
 public bool IsFor(ISelectedDataSets selectedDataSet)
 {
     return(selectedDataSet.ExtractableDataSet_ID == ExtractableDataSet_ID &&
            selectedDataSet.ExtractionConfiguration_ID == ExtractionConfiguration_ID);
 }
 public ReleasePotential GetReleasePotential(IRDMPPlatformRepositoryServiceLocator repositoryLocator, ISelectedDataSets selectedDataSet)
 {
     return(new FlatFileReleasePotential(repositoryLocator, selectedDataSet));
 }
Esempio n. 16
0
 public ExecuteCommandViewExtractionSql(IBasicActivateItems activator, SelectedDataSets sds)
     : base(activator)
 {
     _extractionConfiguration = sds.ExtractionConfiguration;
     _selectedDataSet         = sds;
 }
Esempio n. 17
0
 public FlatFileReleasePotential(IRDMPPlatformRepositoryServiceLocator repositoryLocator, ISelectedDataSets selectedDataSets) : base(repositoryLocator, selectedDataSets)
 {
 }
Esempio n. 18
0
 public void Tick(ISelectedDataSets selectedDataSet)
 {
     tlvReleasePotentials.UncheckAll();
     tlvReleasePotentials.CheckObject(selectedDataSet);
     tlvReleasePotentials.CheckObject(_globalsNode);
 }
 public override ReleasePotential GetReleasePotential(IRDMPPlatformRepositoryServiceLocator repositoryLocator, ISelectedDataSets selectedDataSet)
 {
     return(new MsSqlExtractionReleasePotential(repositoryLocator, selectedDataSet));
 }
Esempio n. 20
0
 public MsSqlExtractionReleasePotential(IRDMPPlatformRepositoryServiceLocator repositoryLocator, ISelectedDataSets selectedDataSets) : base(repositoryLocator, selectedDataSets)
 {
 }