public ExecuteCommandAddCatalogueToCohortIdentificationSetContainer(IBasicActivateItems activator, CatalogueCombineable catalogueCombineable, CohortAggregateContainer targetCohortAggregateContainer) : this(activator, targetCohortAggregateContainer) { _catalogueCombineable = catalogueCombineable; _targetCohortAggregateContainer = targetCohortAggregateContainer; UpdateIsImpossibleFor(catalogueCombineable); }
public override void Execute() { base.Execute(); // if user hasn't picked a Catalogue yet if (_catalogueCombineable == null) { if (!SelectMany(BasicActivator.RepositoryLocator.CatalogueRepository.GetAllObjects <Catalogue>(), out var selected)) { // user didn't pick one return; } // for each catalogue they picked foreach (Catalogue catalogue in selected) { var combineable = new CatalogueCombineable(catalogue); UpdateIsImpossibleFor(combineable); if (IsImpossible) { throw new ImpossibleCommandException(this, ReasonCommandImpossible); } // add it to the cic container Execute(combineable, catalogue == selected.Last()); } } else { Execute(_catalogueCombineable, true); } }
public ExecuteCommandAddCatalogueToCohortIdentificationAsPatientIndexTable(IBasicActivateItems activator, CatalogueCombineable catalogue, CohortIdentificationConfiguration configuration) : this(activator, configuration) { _catalogue = catalogue; if (!_catalogue.Catalogue.IsApiCall() && !_catalogue.ContainsAtLeastOneExtractionIdentifier) { SetImpossible("Catalogue " + _catalogue.Catalogue + " does not contain any IsExtractionIdentifier columns"); } }
public ExecuteCommandAddCatalogueToCohortIdentificationSetContainer(IBasicActivateItems activator, CatalogueCombineable catalogueCombineable, CohortAggregateContainer targetCohortAggregateContainer) : base(activator) { _catalogueCombineable = catalogueCombineable; _targetCohortAggregateContainer = targetCohortAggregateContainer; if (!catalogueCombineable.ContainsAtLeastOneExtractionIdentifier) { SetImpossible("Catalogue " + catalogueCombineable.Catalogue + " does not contain any IsExtractionIdentifier columns"); } }
private void UpdateIsImpossibleFor(CatalogueCombineable catalogueCombineable) { if (catalogueCombineable.Catalogue.IsApiCall()) { return; } if (!catalogueCombineable.ContainsAtLeastOneExtractionIdentifier) { SetImpossible("Catalogue " + catalogueCombineable.Catalogue + " does not contain any IsExtractionIdentifier columns"); } }
public void CreateCohortSet(CohortIdentificationConfiguration cic, CohortAggregateContainer targetContainer, int order) { var cata = cbxCatalogues.SelectedItem as Catalogue; if (cata == null) { throw new Exception("Catalogue has not been picked!"); } var cataCommand = new CatalogueCombineable(cata); //use this one cataCommand.ResolveMultipleExtractionIdentifiers = (s, e) => cbxColumns.SelectedItem as ExtractionInformation; var cmd = new ExecuteCommandAddCatalogueToCohortIdentificationSetContainer(_activator, cataCommand, targetContainer); cmd.SkipMandatoryFilterCreation = true; cmd.Execute(); var aggregate = cmd.AggregateCreatedIfAny; var filterOp = (FilterContainerOperation)ddAndOr.SelectedItem; IContainer filterContainer; if (aggregate.RootFilterContainer_ID != null) { //this is the case if there are mandatory filters in the dataset filterContainer = aggregate.RootFilterContainer; filterContainer.Operation = filterOp; filterContainer.SaveToDatabase(); } else { filterContainer = new AggregateFilterContainer(_activator.RepositoryLocator.CatalogueRepository, filterOp); } aggregate.Order = order; aggregate.RootFilterContainer_ID = filterContainer.ID; aggregate.SaveToDatabase(); List <IFilter> filtersAddedSoFar = new List <IFilter>(); foreach (var ui in _filterUIs) { var f = ui.CreateFilter(new AggregateFilterFactory(_activator.RepositoryLocator.CatalogueRepository), filterContainer, filtersAddedSoFar.ToArray()); filtersAddedSoFar.Add(f); } }
private void Execute(CatalogueCombineable catalogueCombineable, bool publish) { var cmd = catalogueCombineable.GenerateAggregateConfigurationFor(BasicActivator, _targetCohortAggregateContainer, !SkipMandatoryFilterCreation); if (cmd != null) { _postImportCommand = new ExecuteCommandAddAggregateConfigurationToCohortIdentificationSetContainer(BasicActivator, cmd, _targetCohortAggregateContainer) { DoNotClone = true, NoPublish = !publish }; _postImportCommand.Execute(); } }
private void AddCatalogues() { SelectIMapsDirectlyToDatabaseTableDialog dialog = new SelectIMapsDirectlyToDatabaseTableDialog(_activator, RepositoryLocator.CatalogueRepository.GetAllObjects <Catalogue>(), false, false); dialog.AllowMultiSelect = true; if (dialog.ShowDialog() == DialogResult.OK) { if (!dialog.MultiSelected.Any()) { return; } PopupChecksUI checks = new PopupChecksUI("Adding Catalogues", true); foreach (Catalogue catalogue in dialog.MultiSelected) { try { var cmd = new CatalogueCombineable(catalogue); var cmdExecution = new ExecuteCommandAddCatalogueToCohortIdentificationSetContainer(_activator, cmd, _container); if (cmdExecution.IsImpossible) { checks.OnCheckPerformed( new CheckEventArgs( "Could not add Catalogue " + catalogue + " because of Reason:" + cmdExecution.ReasonCommandImpossible, CheckResult.Fail)); } else { cmdExecution.Execute(); checks.OnCheckPerformed(new CheckEventArgs("Successfully added Catalogue " + catalogue, CheckResult.Success)); } } catch (Exception e) { checks.OnCheckPerformed(new CheckEventArgs("Failed to add Catalogue " + catalogue + "(see Exception for details)", CheckResult.Fail, e)); } } } }
public override void Execute() { base.Execute(); if (_catalogue == null) { Catalogue cata; if (!SelectOne(BasicActivator.RepositoryLocator.CatalogueRepository.GetAllObjects <Catalogue>(), out cata)) { return; } _catalogue = new CatalogueCombineable(cata); } AggregateConfigurationCombineable aggregateCommand = _catalogue.GenerateAggregateConfigurationFor(BasicActivator, _configuration); var joinableCommandExecution = new ExecuteCommandConvertAggregateConfigurationToPatientIndexTable(BasicActivator, aggregateCommand, _configuration); joinableCommandExecution.Execute(); }
public ExecuteCommandPutCatalogueIntoCatalogueFolder(IBasicActivateItems activator, CatalogueCombineable cmd, CatalogueFolder targetModel) : this(activator, new [] { cmd.Catalogue }, targetModel) { }