Example #1
0
 private void OnCohortCreatedSuccessfully(IPipelineRunner runner, ICohortCreationRequest request)
 {
     if (request.CohortCreatedIfAny != null)
     {
         Publish(request.CohortCreatedIfAny);
     }
 }
Example #2
0
        protected IPipelineRunner GetConfigureAndExecuteControl(ICohortCreationRequest request, string description)
        {
            var catalogueRepository = BasicActivator.RepositoryLocator.CatalogueRepository;

            var pipelineRunner = BasicActivator.GetPipelineRunner(request, Pipeline);

            pipelineRunner.PipelineExecutionFinishedsuccessfully += (o, args) => OnCohortCreatedSuccessfully(pipelineRunner, request);

            //add in the logging server
            var loggingServer = catalogueRepository.GetServerDefaults().GetDefaultFor(PermissableDefaults.LiveLoggingServer_ID);

            if (loggingServer != null)
            {
                var logManager = new LogManager(loggingServer);
                logManager.CreateNewLoggingTaskIfNotExists(ExtractableCohort.CohortLoggingTask);

                //create a db listener
                var toDbListener = new ToLoggingDatabaseDataLoadEventListener(this, logManager, ExtractableCohort.CohortLoggingTask, description);

                //make all messages go to both the db and the UI
                pipelineRunner.SetAdditionalProgressListener(toDbListener);

                //after executing the pipeline finalise the db listener table info records
                pipelineRunner.PipelineExecutionFinishedsuccessfully += (s, e) => toDbListener.FinalizeTableLoadInfos();
            }

            return(pipelineRunner);
        }
Example #3
0
        /// <inheritdoc/>
        public void Initialize(ICohortCreationRequest request)
        {
            if (!request.Project.ProjectNumber.HasValue)
            {
                throw new ProjectNumberException("Project " + request.Project + " must have a ProjectNumber");
            }

            _request       = request;
            _projectNumber = request.Project.ProjectNumber.Value;
        }
        /// <summary>
        /// Initialises <see cref="Request"/>
        /// </summary>
        /// <param name="value"></param>
        /// <param name="listener"></param>
        public virtual void PreInitialize(ICohortCreationRequest value, IDataLoadEventListener listener)
        {
            Request = value;

            var target = Request.NewCohortDefinition.LocationOfCohort;

            var syntax = target.GetQuerySyntaxHelper();

            _privateIdentifier = syntax.GetRuntimeName(target.PrivateIdentifierField);
            _releaseIdentifier = syntax.GetRuntimeName(target.ReleaseIdentifierField);

            _fk = syntax.GetRuntimeName(Request.NewCohortDefinition.LocationOfCohort.DefinitionTableForeignKeyField);

            listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "CohortCreationRequest spotted, we will look for columns " + _privateIdentifier + " and " + _releaseIdentifier + " (both of which must be in the pipeline before we will allow the cohort to be submitted)"));
            listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "id column in table " + Request.NewCohortDefinition.LocationOfCohort.TableName + " is " + Request.NewCohortDefinition.LocationOfCohort.DefinitionTableForeignKeyField));
        }
        /// <inheritdoc/>
        public void Initialize(ICohortCreationRequest request)
        {
            if (request.Project != null)
            {
                if (!request.Project.ProjectNumber.HasValue)
                {
                    throw new ProjectNumberException("Project " + request.Project + " must have a ProjectNumber");
                }
            }
            else
            {
                if ((request.NewCohortDefinition?.ProjectNumber ?? 0) == 0)
                {
                    throw new ProjectNumberException("No Project was specified and NewCohortDefinition had no explicit project number");
                }
            }

            _request       = request;
            _projectNumber = request.Project?.ProjectNumber.Value ?? request.NewCohortDefinition?.ProjectNumber ?? 0;
        }
 public void Initialize(ICohortCreationRequest request)
 {
 }