コード例 #1
0
 /// <summary>
 /// Reads an existing parameter out of the database
 /// </summary>
 /// <param name="repository"></param>
 /// <param name="r"></param>
 internal DeployedExtractionFilterParameter(IDataExportRepository repository, DbDataReader r) : base(repository, r)
 {
     ExtractionFilter_ID = int.Parse(r["ExtractionFilter_ID"].ToString());
     ParameterSQL        = r["ParameterSQL"] as string;
     Value   = r["Value"] as string;
     Comment = r["Comment"] as string;
 }
コード例 #2
0
        /// <summary>
        /// For refreshing the current extraction configuration CohortIdentificationConfiguration ONLY.  The ExtractionConfiguration must have a cic and a refresh pipeline configured on it.
        /// </summary>
        /// <param name="configuration"></param>
        public CohortCreationRequest(ExtractionConfiguration configuration)
        {
            _repository = (DataExportRepository)configuration.Repository;

            if (configuration.CohortIdentificationConfiguration_ID == null)
            {
                throw new NotSupportedException("Configuration '" + configuration + "' does not have an associated CohortIdentificationConfiguration for cohort refreshing");
            }

            var origCohort     = configuration.Cohort;
            var origCohortData = origCohort.GetExternalData();

            CohortIdentificationConfiguration = configuration.CohortIdentificationConfiguration;
            Project = configuration.Project;

            if (Project.ProjectNumber == null)
            {
                throw new ProjectNumberException("Project '" + Project + "' does not have a ProjectNumber");
            }

            var definition = new CohortDefinition(null, origCohortData.ExternalDescription, origCohortData.ExternalVersion + 1, (int)Project.ProjectNumber, origCohort.ExternalCohortTable);

            definition.CohortReplacedIfAny = origCohort;

            NewCohortDefinition    = definition;
            DescriptionForAuditLog = "Cohort Refresh";

            AddInitializationObject(Project);
            AddInitializationObject(CohortIdentificationConfiguration);
            AddInitializationObject(FileToLoad);
            AddInitializationObject(ExtractionIdentifierColumn);
            AddInitializationObject(this);

            GenerateContext();
        }
コード例 #3
0
 /// <summary>
 /// Reads an <see cref="ExtractableDataSetPackage"/> out of the data export database
 /// </summary>
 /// <param name="dataExportRepository"></param>
 /// <param name="r"></param>
 public ExtractableDataSetPackage(IDataExportRepository dataExportRepository, DbDataReader r)
     : base(dataExportRepository, r)
 {
     Name = r["Name"].ToString();
     Creator = r["Creator"].ToString();
     CreationDate = Convert.ToDateTime(r["CreationDate"]);
 }
コード例 #4
0
ファイル: SelectedDataSets.cs プロジェクト: 24418863/rdm
 internal SelectedDataSets(IDataExportRepository repository, DbDataReader r)
     : base(repository, r)
 {
     ExtractionConfiguration_ID = Convert.ToInt32(r["ExtractionConfiguration_ID"]);
     ExtractableDataSet_ID      = Convert.ToInt32(r["ExtractableDataSet_ID"]);
     RootFilterContainer_ID     = ObjectToNullableInt(r["RootFilterContainer_ID"]);
 }
コード例 #5
0
        /// <summary>
        /// Returns true if the Catalogue <paramref name="c"/> should be included in the good/bad counts
        /// based on the flags e.g. <see cref="IncludeDeprecatedCatalogues"/>
        /// </summary>
        /// <param name="c"></param>
        /// <param name="repo"></param>
        /// <returns></returns>
        public bool Include(Catalogue c, IDataExportRepository repo)
        {
            bool returnValue = true;

            var status = c.GetExtractabilityStatus(repo);

            if (!status.IsExtractable)
            {
                returnValue &= IncludeNonExtractableCatalogues;
            }

            if (status.IsProjectSpecific)
            {
                returnValue &= IncludeProjectSpecificCatalogues;
            }

            if (c.IsColdStorageDataset)
            {
                returnValue &= IncludeColdStorageCatalogues;
            }

            if (c.IsDeprecated)
            {
                returnValue &= IncludeDeprecatedCatalogues;
            }

            if (c.IsInternalDataset)
            {
                returnValue &= IncludeInternalCatalogueItems;
            }


            return(returnValue);
        }
コード例 #6
0
        /// <summary>
        /// Defines a new extraction project this is stored in the Data Export database
        /// </summary>
        public Project(IDataExportRepository repository, string name)
        {
            Repository = repository;

            try
            {
                Repository.InsertAndHydrate(this, new Dictionary <string, object>
                {
                    { "Name", name }
                });
            }
            catch (Exception ex)
            {
                //sometimes the user tries to create multiple Projects without fully populating the last one (with a project number)
                if (ex.Message.Contains("idx_ProjectNumberMustBeUnique"))
                {
                    Project offender;
                    try
                    {
                        //find the one with the unset project number
                        offender = Repository.GetAllObjects <Project>().Single(p => p.ProjectNumber == null);
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    throw new Exception("Could not create a new Project because there is already another Project in the system (" + offender + ") which is missing a Project Number.  All projects must have a ProjectNumber, there can be 1 Project at a time which does not have a number and that is one that is being built by the user right now.  Either delete Project " + offender + " or give it a project number", ex);
                }

                throw;
            }
        }
コード例 #7
0
 public CreateNewCohortDatabaseWizard(DiscoveredDatabase targetDatabase, ICatalogueRepository catalogueRepository, IDataExportRepository dataExportRepository, bool allowNullReleaseIdentifiers)
 {
     AllowNullReleaseIdentifiers = allowNullReleaseIdentifiers;
     _catalogueRepository        = catalogueRepository;
     _dataExportRepository       = dataExportRepository;
     _targetDatabase             = targetDatabase;
 }
コード例 #8
0
        /// <summary>
        /// Reads an existing cohort database reference out of the metadata repository database
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="r"></param>
        internal ExternalCohortTable(IDataExportRepository repository, DbDataReader r)
            : base(repository, r)
        {
            Name = r["Name"] as string;
            var databaseType = (DatabaseType)Enum.Parse(typeof(DatabaseType), r["DatabaseType"].ToString());

            SelfCertifyingDataAccessPoint = new SelfCertifyingDataAccessPoint(((DataExportRepository)repository).CatalogueRepository, databaseType);

            Server   = r["Server"] as string;
            Username = r["Username"] as string;
            Password = r["Password"] as string;
            Database = r["Database"] as string;

            var syntaxHelper = GetQuerySyntaxHelper();


            TableName = syntaxHelper.EnsureFullyQualified(Database, null, r["TableName"] as string);
            DefinitionTableForeignKeyField = syntaxHelper.EnsureFullyQualified(Database, null, TableName, r["DefinitionTableForeignKeyField"] as string);

            DefinitionTableName = syntaxHelper.EnsureFullyQualified(Database, null, r["DefinitionTableName"] as string);


            PrivateIdentifierField = syntaxHelper.EnsureFullyQualified(Database, null, TableName, r["PrivateIdentifierField"] as string);
            ReleaseIdentifierField = syntaxHelper.EnsureFullyQualified(Database, null, TableName, r["ReleaseIdentifierField"] as string);
        }
コード例 #9
0
        internal ProjectCohortIdentificationConfigurationAssociation(IDataExportRepository repository, DbDataReader r)
            : base(repository, r)
        {
            Project_ID = Convert.ToInt32(r["Project_ID"]);
            CohortIdentificationConfiguration_ID = Convert.ToInt32(r["CohortIdentificationConfiguration_ID"]);

            ClearAllInjections();
        }
コード例 #10
0
 /// <summary>
 /// Creates a new instance with the given <paramref name="operation"/>
 /// </summary>
 /// <param name="repository"></param>
 /// <param name="operation"></param>
 public FilterContainer(IDataExportRepository repository, FilterContainerOperation operation = FilterContainerOperation.AND) : base(repository.FilterManager)
 {
     Repository = repository;
     Repository.InsertAndHydrate(this, new Dictionary <string, object>
     {
         { "Operation", operation.ToString() }
     });
 }
コード例 #11
0
 /// <summary>
 /// Reads an existing instance out of the database
 /// </summary>
 /// <param name="repository"></param>
 /// <param name="r"></param>
 internal GlobalExtractionFilterParameter(IDataExportRepository repository, DbDataReader r)
     : base(repository, r)
 {
     Value = r["Value"] as string;
     ExtractionConfiguration_ID = (int)r["ExtractionConfiguration_ID"];
     ParameterSQL = r["ParameterSQL"] as string;
     Comment      = r["Comment"] as string;
 }
コード例 #12
0
        internal ExtractableDataSet(IDataExportRepository repository, DbDataReader r)
            : base(repository, r)
        {
            Catalogue_ID      = Convert.ToInt32(r["Catalogue_ID"]);
            DisableExtraction = (bool)r["DisableExtraction"];
            Project_ID        = ObjectToNullableInt(r["Project_ID"]);

            ClearAllInjections();
        }
コード例 #13
0
 /// <summary>
 /// Creates a new empty WHERE filter in the given <paramref name="container"/> that will be used when
 /// extracting the dataset.
 ///
 /// <para>This object is created into the data export metadata database</para>
 /// </summary>
 /// <param name="repository"></param>
 /// <param name="name"></param>
 /// <param name="container"></param>
 public DeployedExtractionFilter(IDataExportRepository repository, string name, FilterContainer container)
 {
     Repository = repository;
     Repository.InsertAndHydrate(this, new Dictionary <string, object>
     {
         { "Name", name != null ? (object)name : DBNull.Value },
         { "FilterContainer_ID", container != null ? (object)container.ID : DBNull.Value }
     });
 }
コード例 #14
0
        internal Project(IDataExportRepository repository, DbDataReader r)
            : base(repository, r)
        {
            MasterTicket        = r["MasterTicket"].ToString();
            Name                = r["Name"] as string;
            ExtractionDirectory = r["ExtractionDirectory"] as string;

            ProjectNumber = ObjectToNullableInt(r["ProjectNumber"]);
        }
コード例 #15
0
        public CatalogueStateBasedIconProvider(IDataExportRepository dataExportRepository,
                                               IconOverlayProvider overlayProvider)
        {
            _basic           = CatalogueIcons.Catalogue;
            _projectSpecific = CatalogueIcons.ProjectCatalogue;

            _dataExportRepository = dataExportRepository;
            _overlayProvider      = overlayProvider;
        }
コード例 #16
0
 /// <summary>
 /// Creates a new <see cref="ExtractableDataSetPackage"/> in the data export database with the supplied <paramref name="name"/>
 /// </summary>
 /// <param name="dataExportRepository"></param>
 /// <param name="name"></param>
 public ExtractableDataSetPackage(IDataExportRepository dataExportRepository, string name)
 {
     dataExportRepository.InsertAndHydrate(this,new Dictionary<string, object>()
     {
         {"Name",name},
         {"Creator",Environment.UserName},
         {"CreationDate",DateTime.Now }
     });
 }
コード例 #17
0
        /// <summary>
        /// Creates a new parameter into the <paramref name="repository"/> database acting as a global parameter for all <see cref="ISelectedDataSets"/> in the <paramref name="configuration"/>
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="configuration"></param>
        /// <param name="parameterSQL"></param>
        public GlobalExtractionFilterParameter(IDataExportRepository repository, ExtractionConfiguration configuration, string parameterSQL)
        {
            Repository = repository;

            Repository.InsertAndHydrate(this, new Dictionary <string, object>
            {
                { "ParameterSQL", parameterSQL },
                { "ExtractionConfiguration_ID", configuration.ID }
            });
        }
コード例 #18
0
 /// <summary>
 /// Creates a new blank pointer to a cohort database.
 /// </summary>
 /// <param name="repository">Metadata repository in which to create the object</param>
 /// <param name="name"></param>
 /// <param name="databaseType"></param>
 public ExternalCohortTable(IDataExportRepository repository, string name, DatabaseType databaseType)
 {
     Repository = repository;
     SelfCertifyingDataAccessPoint = new SelfCertifyingDataAccessPoint(repository.CatalogueRepository, databaseType);
     Repository.InsertAndHydrate(this, new Dictionary <string, object>
     {
         { "Name", name ?? "NewExternalSource" + Guid.NewGuid() },
         { "DatabaseType", databaseType.ToString() }
     });
 }
コード例 #19
0
        /// <summary>
        /// Creates a new parameter in the metadata database.
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="parameterSQL">Declaration SQL for the parameter e.g. "DECLARE @bob as varchar(10)"</param>
        /// <param name="parent"></param>
        public DeployedExtractionFilterParameter(IDataExportRepository repository, string parameterSQL, IFilter parent)
        {
            Repository = repository;

            Repository.InsertAndHydrate(this, new Dictionary <string, object>
            {
                { "ParameterSQL", parameterSQL },
                { "ExtractionFilter_ID", parent.ID }
            });
        }
コード例 #20
0
        internal ExtractableCohort(IDataExportRepository repository, DbDataReader r)
            : base(repository, r)
        {
            OverrideReleaseIdentifierSQL = r["OverrideReleaseIdentifierSQL"] as string;
            OriginID = Convert.ToInt32(r["OriginID"]);
            ExternalCohortTable_ID = Convert.ToInt32(r["ExternalCohortTable_ID"]);
            AuditLog     = r["AuditLog"] as string;
            IsDeprecated = (bool)r["IsDeprecated"];

            ClearAllInjections();
        }
コード例 #21
0
 public ReleaseLog(IDataExportRepository repository, DbDataReader r) : base(repository, r)
 {
     CumulativeExtractionResults_ID = Convert.ToInt32(r["CumulativeExtractionResults_ID"]);
     Username         = r["Username"].ToString();
     MD5OfDatasetFile = r["MD5OfDatasetFile"].ToString();
     DatasetState     = r["DatasetState"].ToString();
     EnvironmentState = r["EnvironmentState"].ToString();
     DateOfRelease    = Convert.ToDateTime(r["DateOfRelease"]);
     IsPatch          = Convert.ToBoolean(r["IsPatch"]);
     ReleaseFolder    = r["ReleaseFolder"].ToString();
 }
コード例 #22
0
ファイル: ReleaseEngine.cs プロジェクト: HicServices/RDMP
        public ReleaseEngine(Project project, ReleaseEngineSettings settings, IDataLoadEventListener listener, ReleaseAudit releaseAudit)
        {
            _repository            = project.DataExportRepository;
            Project                = project;
            ReleaseSuccessful      = false;
            ConfigurationsReleased = new List <IExtractionConfiguration>();

            ReleaseSettings = settings ?? new ReleaseEngineSettings();
            _listener       = listener ?? new ToMemoryDataLoadEventListener(false);

            ReleaseAudit = releaseAudit;
        }
コード例 #23
0
ファイル: SelectedDataSets.cs プロジェクト: 24418863/rdm
        /// <summary>
        /// Declares in the <paramref name="repository"/> database that the given <paramref name="dataSet"/> should be extracted as part of the given <paramref name="configuration"/>.
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="configuration"></param>
        /// <param name="dataSet"></param>
        /// <param name="rootContainerIfAny">Adds the restriction that the extraction SQL should include the WHERE logic in this container</param>
        public SelectedDataSets(IDataExportRepository repository, ExtractionConfiguration configuration, IExtractableDataSet dataSet, FilterContainer rootContainerIfAny)
        {
            repository.InsertAndHydrate(this, new Dictionary <string, object>()
            {
                { "ExtractionConfiguration_ID", configuration.ID },
                { "ExtractableDataSet_ID", dataSet.ID },
                { "RootFilterContainer_ID", rootContainerIfAny != null?(object)rootContainerIfAny.ID:DBNull.Value }
            });

            ClearAllInjections();
            InjectKnown(dataSet);
        }
コード例 #24
0
        /// <summary>
        /// Defines that the given Catalogue is extractable to researchers as a data set, this is stored in the DataExport database
        /// </summary>
        /// <returns></returns>
        public ExtractableDataSet(IDataExportRepository repository, ICatalogue catalogue, bool disableExtraction = false)
        {
            Repository = repository;
            Repository.InsertAndHydrate(this, new Dictionary <string, object>
            {
                { "DisableExtraction", disableExtraction },
                { "Catalogue_ID", catalogue.ID }
            });

            ClearAllInjections();
            InjectKnown(catalogue);
        }
コード例 #25
0
        /// <summary>
        /// Creates a new audit record in the data export database for describing an extraction attempt of the given <paramref name="dataset"/> in the
        /// extraction <paramref name="configuration"/>.
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="configuration"></param>
        /// <param name="dataset"></param>
        /// <param name="sql"></param>
        public CumulativeExtractionResults(IDataExportRepository repository, IExtractionConfiguration configuration, IExtractableDataSet dataset, string sql)
        {
            Repository = repository;
            Repository.InsertAndHydrate(this, new Dictionary <string, object>
            {
                { "ExtractionConfiguration_ID", configuration.ID },
                { "ExtractableDataSet_ID", dataset.ID },
                { "SQLExecuted", sql },
                { "CohortExtracted", configuration.Cohort_ID }
            });

            ClearAllInjections();
        }
コード例 #26
0
        public CohortCreationRequest(IProject project, ICohortDefinition newCohortDefinition, IDataExportRepository repository, string descriptionForAuditLog)
        {
            _repository         = repository;
            Project             = project;
            NewCohortDefinition = newCohortDefinition;

            DescriptionForAuditLog = descriptionForAuditLog;

            AddInitializationObject(Project);
            AddInitializationObject(this);

            GenerateContext();
        }
コード例 #27
0
        /// <summary>
        /// Creates a new extraction configuration in the <paramref name="repository"/> database for the provided <paramref name="project"/>.
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="project"></param>
        public ExtractionConfiguration(IDataExportRepository repository, IProject project)
        {
            Repository = repository;

            Repository.InsertAndHydrate(this, new Dictionary <string, object>
            {
                { "dtCreated", DateTime.Now },
                { "Project_ID", project.ID },
                { "Username", Environment.UserName },
                { "Description", "Initial Configuration" },
                { "Name", "New ExtractionConfiguration" + Guid.NewGuid() }
            });
        }
コード例 #28
0
ファイル: ExtractableColumn.cs プロジェクト: rkm/RDMP
        /// <summary>
        /// Creates a new line of SELECT Sql for the given <paramref name="dataset"/> as it is extracted in the provided <paramref name="configuration"/>.  The new object will
        /// be created in the <paramref name="repository"/> database.
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="dataset"></param>
        /// <param name="configuration"></param>
        /// <param name="extractionInformation"></param>
        /// <param name="order"></param>
        /// <param name="selectSQL"></param>
        public ExtractableColumn(IDataExportRepository repository, IExtractableDataSet dataset, ExtractionConfiguration configuration, ExtractionInformation extractionInformation, int order, string selectSQL)
        {
            Repository = repository;
            Repository.InsertAndHydrate(this, new Dictionary <string, object>
            {
                { "ExtractableDataSet_ID", dataset.ID },
                { "ExtractionConfiguration_ID", configuration.ID },
                { "CatalogueExtractionInformation_ID", extractionInformation == null ? DBNull.Value : (object)extractionInformation.ID },
                { "Order", order },
                { "SelectSQL", string.IsNullOrWhiteSpace(selectSQL) ? DBNull.Value : (object)selectSQL }
            });

            ClearAllInjections();
        }
コード例 #29
0
ファイル: ReleaseLog.cs プロジェクト: 24418863/rdm
 public ReleaseLog(IDataExportRepository repository, ReleasePotential dataset, ReleaseEnvironmentPotential environment, bool isPatch, DirectoryInfo releaseDirectory, FileInfo datasetFileBeingReleased)
 {
     repository.InsertAndHydrate(this,
                                 new Dictionary <string, object>
     {
         { "CumulativeExtractionResults_ID", dataset.DatasetExtractionResult.ID },
         { "Username", Environment.UserName },
         { "DateOfRelease", DateTime.Now },
         { "MD5OfDatasetFile", datasetFileBeingReleased == null ? "X" : UsefulStuff.HashFile(datasetFileBeingReleased.FullName) },
         { "DatasetState", dataset.DatasetExtractionResult.ToString() },
         { "EnvironmentState", environment.Assesment.ToString() },
         { "IsPatch", isPatch },
         { "ReleaseFolder", releaseDirectory.FullName }
     });
 }
コード例 #30
0
        /// <summary>
        /// Declares in the <paramref name="repository"/> database that the given <paramref name="cic"/> cohort query is associated with the supplied <paramref name="project"/>.
        /// This is usually done after using the query to build an <see cref="IExtractableCohort"/> (But it can be done manually by the user too).
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="project"></param>
        /// <param name="cic"></param>
        public ProjectCohortIdentificationConfigurationAssociation(IDataExportRepository repository, Project project, CohortIdentificationConfiguration cic)
        {
            repository.InsertAndHydrate(this, new Dictionary <string, object>()
            {
                { "Project_ID", project.ID },
                { "CohortIdentificationConfiguration_ID", cic.ID }
            });

            if (ID == 0 || Repository != repository)
            {
                throw new ArgumentException("Repository failed to properly hydrate this class");
            }

            ClearAllInjections();
        }