private void AddChildren(Project project, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); var projectCohortNode = new ProjectCohortsNode(project); children.Add(projectCohortNode); AddChildren(projectCohortNode, descendancy.Add(projectCohortNode)); var projectCataloguesNode = new ProjectCataloguesNode(project); children.Add(projectCataloguesNode); AddChildren(projectCataloguesNode, descendancy.Add(projectCataloguesNode).SetNewBestRoute()); var extractionConfigurationsNode = new ExtractionConfigurationsNode(project); children.Add(extractionConfigurationsNode); AddChildren(extractionConfigurationsNode, descendancy.Add(extractionConfigurationsNode)); var folder = new ExtractionDirectoryNode(project); children.Add(folder); AddToDictionaries(children, descendancy); }
/// <summary> /// Returns true if the given <paramref name="modelObject"/> survives filtering based on the supplied inclusion /// criteria. Anything that isn't in some way related to a <see cref="Catalogue"/> automatically survives filtering /// </summary> /// <param name="modelObject"></param> /// <param name="descendancy"></param> /// <param name="includeInternal"></param> /// <param name="includeDeprecated"></param> /// <param name="includeColdStorage"></param> /// <param name="includeProjectSpecific"></param> /// <param name="includeNonExtractable"></param> /// <returns>True if the item should be shown to the user based on filters</returns> public static bool Filter(object modelObject, DescendancyList descendancy, bool includeInternal, bool includeDeprecated, bool includeColdStorage, bool includeProjectSpecific, bool includeNonExtractable) { var cata = modelObject as ICatalogue; //doesn't relate to us... if (cata == null) { // or are we one of these things that can be tied to a catalogue cata = modelObject switch { ExtractableDataSet eds => eds.Catalogue, SelectedDataSets sds => sds.GetCatalogue(), _ => descendancy?.Parents.OfType <Catalogue>().SingleOrDefault() }; if (cata == null) { return(true); } } bool isProjectSpecific = cata.IsProjectSpecific(null); bool isExtractable = cata.GetExtractabilityStatus(null) != null && cata.GetExtractabilityStatus(null).IsExtractable; return((isExtractable && !cata.IsColdStorageDataset && !cata.IsDeprecated && !cata.IsInternalDataset && !isProjectSpecific) || ((includeColdStorage && cata.IsColdStorageDataset) || (includeDeprecated && cata.IsDeprecated) || (includeInternal && cata.IsInternalDataset) || (includeProjectSpecific && isProjectSpecific) || (includeNonExtractable && !isExtractable))); }
private void AddChildren(ExtractionConfiguration extractionConfiguration, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); var parameters = AllGlobalExtractionFilterParameters.Where(p => p.ExtractionConfiguration_ID == extractionConfiguration.ID) .ToArray(); if (parameters.Any()) { var parameterNode = new ParametersNode(extractionConfiguration, parameters); children.Add(parameterNode); } //if it has a cohort if (extractionConfiguration.Cohort_ID != null) { var cohort = Cohorts.Single(c => c.ID == extractionConfiguration.Cohort_ID); children.Add(new LinkedCohortNode(extractionConfiguration, cohort)); } //if it has extractable datasets add those foreach (SelectedDataSets ds in GetDatasets(extractionConfiguration)) { children.Add(ds); AddChildren(ds, descendancy.Add(ds)); } AddToDictionaries(children, descendancy); }
private void AddChildren(IExtractableDataSetPackage package, DescendancyList descendancy) { var children = new HashSet <object>(dataExportRepository.PackageManager.GetAllDataSets(package, ExtractableDataSets) .Select(ds => new PackageContentNode(package, ds, dataExportRepository.PackageManager))); AddToDictionaries(children, descendancy); }
private void AddChildren(SelectedDataSets selectedDataSets, DescendancyList descendancy) { if (selectedDataSets.RootFilterContainer_ID != null) { var rootContainer = AllContainers[selectedDataSets.RootFilterContainer_ID.Value]; AddChildren(rootContainer, descendancy.Add(rootContainer)); AddToDictionaries(new HashSet <object>(new object[] { rootContainer }), descendancy); } }
private void AddChildren(AllCohortsNode cohortsNode, DescendancyList descendancy) { var validSources = CohortSources.ToArray(); AddToDictionaries(new HashSet <object>(validSources), descendancy); foreach (var s in validSources) { AddChildren(s, descendancy.Add(s)); } }
/// <summary> /// Returns a new DescendancyList with BetterRouteExists set to true, this means the system will bear in mind it might see a better DescendancyList later on /// in which case it will use that better route instead /// </summary> /// <returns></returns> public DescendancyList SetBetterRouteExists() { NewBestRoute = false; BetterRouteExists = true; var toReturn = new DescendancyList(Parents); toReturn.NewBestRoute = false; toReturn.BetterRouteExists = true; return(toReturn); }
private void AddChildren(ExternalCohortTable externalCohortTable, DescendancyList descendancy) { var cohorts = Cohorts.Where(c => c.ExternalCohortTable_ID == externalCohortTable.ID).ToArray(); foreach (ExtractableCohort cohort in cohorts) { cohort.InjectKnown(externalCohortTable); } AddToDictionaries(new HashSet <object>(cohorts), descendancy); }
private void AddChildren(ProjectCataloguesNode projectCataloguesNode, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); foreach (ExtractableDataSet projectSpecificEds in ExtractableDataSets.Where(eds => eds.Project_ID == projectCataloguesNode.Project.ID)) { children.Add(projectSpecificEds.Catalogue); AddChildren((Catalogue)projectSpecificEds.Catalogue, descendancy.Add(projectSpecificEds.Catalogue)); } AddToDictionaries(children, descendancy); }
private void AddChildren(ProjectSavedCohortsNode savedCohortsNode, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); var cohortGroups = GetAllCohortProjectUsageNodesFor(savedCohortsNode.Project); foreach (CohortSourceUsedByProjectNode cohortSourceUsedByProjectNode in cohortGroups) { AddChildren(cohortSourceUsedByProjectNode, descendancy.Add(cohortSourceUsedByProjectNode)); children.Add(cohortSourceUsedByProjectNode); } AddToDictionaries(children, descendancy); }
private void AddChildren(ProjectCohortsNode projectCohortsNode, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); var projectCiCsNode = new ProjectCohortIdentificationConfigurationAssociationsNode(projectCohortsNode.Project); children.Add(projectCiCsNode); AddChildren(projectCiCsNode, descendancy.Add(projectCiCsNode)); var savedCohortsNode = new ProjectSavedCohortsNode(projectCohortsNode.Project); children.Add(savedCohortsNode); AddChildren(savedCohortsNode, descendancy.Add(savedCohortsNode)); AddToDictionaries(children, descendancy); }
/// <summary> /// Returns a new instance of DescendancyList that includes the new parent appended to the end of parent hierarchy. You can only add to the end so /// if you have Root=>Grandparent then the only thing you should add is Parent. /// </summary> /// <param name="anotherKnownParent"></param> /// <returns></returns> public DescendancyList Add(object anotherKnownParent) { if (Parents.Contains(anotherKnownParent)) { throw new ArgumentException("DecendancyList already contains '" + anotherKnownParent + "'"); } var list = new List <object>(Parents); list.Add(anotherKnownParent); var toReturn = new DescendancyList(list.ToArray()); toReturn.BetterRouteExists = BetterRouteExists; toReturn.NewBestRoute = NewBestRoute; return(toReturn); }
private void AddChildren(FilterContainer filterContainer, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); foreach (FilterContainer subcontainer in _dataExportFilterManager.GetSubContainers(filterContainer)) { AddChildren(subcontainer, descendancy.Add(subcontainer)); children.Add(subcontainer); } foreach (var filter in _dataExportFilterManager.GetFilters(filterContainer)) { children.Add(filter); } AddToDictionaries(children, descendancy); }
private void AddChildren(ProjectCataloguesNode projectCataloguesNode, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); foreach (ExtractableDataSet projectSpecificEds in ExtractableDataSets.Where(eds => eds.Project_ID == projectCataloguesNode.Project.ID)) { var cata = (Catalogue)projectSpecificEds.Catalogue; // cata will be null if it has been deleted from the database if (cata != null) { children.Add(cata); AddChildren(cata, descendancy.Add(projectSpecificEds.Catalogue)); } } AddToDictionaries(children, descendancy); }
private void AddChildren(SelectedDataSets selectedDataSets, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); if (_extractionProgressesBySelectedDataSetID.ContainsKey(selectedDataSets.ID)) { children.Add(_extractionProgressesBySelectedDataSetID[selectedDataSets.ID]); } if (selectedDataSets.RootFilterContainer_ID != null) { var rootContainer = AllContainers[selectedDataSets.RootFilterContainer_ID.Value]; children.Add(rootContainer); AddChildren(rootContainer, descendancy.Add(rootContainer)); } if (children.Any()) { AddToDictionaries(children, descendancy); } }
private void AddChildren(FrozenExtractionConfigurationsNode frozenExtractionConfigurationsNode, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); //Add ExtractionConfigurations which are not released (frozen) var configs = ExtractionConfigurations.Where(c => c.Project_ID == frozenExtractionConfigurationsNode.Project.ID).ToArray(); foreach (ExtractionConfiguration config in configs.Where(c => c.IsReleased)) { AddChildren(config, descendancy.Add(config)); children.Add(config); } AddToDictionaries(children, descendancy); }
private void AddChildren(CohortSourceUsedByProjectNode cohortSourceUsedByProjectNode, DescendancyList descendancy) { AddToDictionaries(new HashSet <object>(cohortSourceUsedByProjectNode.CohortsUsed), descendancy); }
private void AddChildren(FrozenExtractionConfigurationsNode frozenExtractionConfigurationsNode, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); //Add ExtractionConfigurations which are not released (frozen) if (ExtractionConfigurationsByProject.TryGetValue(frozenExtractionConfigurationsNode.Project.ID, out List <ExtractionConfiguration> result)) { foreach (ExtractionConfiguration config in result.Where(c => c.IsReleased)) { AddChildren(config, descendancy.Add(config)); children.Add(config); } } AddToDictionaries(children, descendancy); }
private void AddChildren(ExtractionConfigurationsNode extractionConfigurationsNode, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); //Create a frozen extraction configurations folder as a subfolder of each ExtractionConfigurationsNode var frozenConfigurationsNode = new FrozenExtractionConfigurationsNode(extractionConfigurationsNode.Project); //Make the frozen folder appear under the extractionConfigurationsNode children.Add(frozenConfigurationsNode); //Add children to the frozen folder AddChildren(frozenConfigurationsNode, descendancy.Add(frozenConfigurationsNode)); //Add ExtractionConfigurations which are not released (frozen) if (ExtractionConfigurationsByProject.TryGetValue(extractionConfigurationsNode.Project.ID, out List <ExtractionConfiguration> result)) { foreach (ExtractionConfiguration config in result.Where(c => !c.IsReleased)) { AddChildren(config, descendancy.Add(config)); children.Add(config); } } AddToDictionaries(children, descendancy); }
private void AddChildren(ProjectCohortIdentificationConfigurationAssociationsNode projectCiCsNode, DescendancyList descendancy) { //add the associations HashSet <object> children = new HashSet <object>(); foreach (ProjectCohortIdentificationConfigurationAssociation association in AllProjectAssociatedCics.Where(assoc => assoc.Project_ID == projectCiCsNode.Project.ID)) { var matchingCic = AllCohortIdentificationConfigurations.SingleOrDefault(cic => cic.ID == association.CohortIdentificationConfiguration_ID); if (matchingCic == null) { _errorsCheckNotifier.OnCheckPerformed( new CheckEventArgs( "Failed to find Associated Cohort Identification Configuration with ID " + association.CohortIdentificationConfiguration_ID + " which was supposed to be associated with " + association.Project, CheckResult.Fail));//inject knowledge of what the cic is so it doesn't have to be fetched during ToString } else { association.InjectKnown(matchingCic); //document that it is a child of the project cics node children.Add(association); } } AddToDictionaries(children, descendancy); }
private void AddChildren(ExtractionConfigurationsNode extractionConfigurationsNode, DescendancyList descendancy) { HashSet <object> children = new HashSet <object>(); //Create a frozen extraction configurations folder as a subfolder of each ExtractionConfigurationsNode var frozenConfigurationsNode = new FrozenExtractionConfigurationsNode(extractionConfigurationsNode.Project); //Make the frozen folder appear under the extractionConfigurationsNode children.Add(frozenConfigurationsNode); //Add children to the frozen folder AddChildren(frozenConfigurationsNode, descendancy.Add(frozenConfigurationsNode)); //Add ExtractionConfigurations which are not released (frozen) var configs = ExtractionConfigurations.Where(c => c.Project_ID == extractionConfigurationsNode.Project.ID).ToArray(); foreach (ExtractionConfiguration config in configs.Where(c => !c.IsReleased)) { AddChildren(config, descendancy.Add(config)); children.Add(config); } AddToDictionaries(children, descendancy); }
private void AddChildren(DeployedExtractionFilter filter, DescendancyList descendancyList) { AddToDictionaries(new HashSet <object>(_allParameters.Where(p => p.ExtractionFilter_ID == filter.ID)), descendancyList); }