public override void SetDatabaseObject(IActivateItems activator, SelectedDataSets databaseObject) { base.SetDatabaseObject(activator, databaseObject); _extractionConfiguration = databaseObject.ExtractionConfiguration; _extractableDataSet = databaseObject.ExtractableDataSet; RegenerateCodeInQueryEditor(); }
private List <ReleasePotential> GetReleasePotentials(IExtractionConfiguration configuration) { var toReturn = new List <ReleasePotential>(); //create new ReleaseAssesments foreach (ISelectedDataSets selectedDataSet in GetSelectedDataSets(configuration))//todo only the ones user ticked { var extractionResults = selectedDataSet.GetCumulativeExtractionResultsIfAny(); //if it has never been extracted if (extractionResults == null || extractionResults.DestinationDescription == null) { toReturn.Add(new NoReleasePotential(RepositoryLocator, selectedDataSet)); //the potential is ZERO to release this dataset } else { //it's been extracted!, who extracted it? var destinationThatExtractedIt = (IExecuteDatasetExtractionDestination) new ObjectConstructor().Construct(extractionResults.GetDestinationType()); //destination tell us how releasable it is var releasePotential = destinationThatExtractedIt.GetReleasePotential(RepositoryLocator, selectedDataSet); //it is THIS much releasability! toReturn.Add(releasePotential); } } return(toReturn); }
public object GetState(IExtractionConfiguration configuration) { var matches = GetCheckerResults <ReleaseEnvironmentPotential>((rp) => rp.Configuration.Equals(configuration)); if (matches.Length == 0) { return(null); } return(((ReleaseEnvironmentPotential)matches.Single().Key).Assesment); }
/// <summary> /// Change which column is the linkage identifier in a <see cref="Catalogue"/> either at a global level or for a specific <paramref name="inConfiguration"/> /// </summary> /// <param name="activator"></param> /// <param name="catalogue"></param> /// <param name="inConfiguration"></param> /// <param name="column"></param> public ExecuteCommandSetExtractionIdentifier(IBasicActivateItems activator, [DemandsInitialization("The dataset you want to change the extraction identifier for")] ICatalogue catalogue, [DemandsInitialization("Optional - The specific extraction you want the change made in or Null for the Catalogue itself (will affect all future extractions)")] IExtractionConfiguration inConfiguration, [DemandsInitialization("Optional - The Column name(s) you want to select as the new linkage identifier(s). Comma seperate multiple entries if needed")] string column) : base(activator) { _catalogue = catalogue; _inConfiguration = inConfiguration; _catalogue.ClearAllInjections(); if (inConfiguration != null) { var allEds = inConfiguration.GetAllExtractableDataSets(); var eds = allEds.FirstOrDefault(sds => sds.Catalogue_ID == _catalogue.ID); if (eds == null) { SetImpossible($"Catalogue '{_catalogue}' is not part of ExtractionConfiguration '{inConfiguration}'"); return; } _selectedDataSetColumns = inConfiguration.GetAllExtractableColumnsFor(eds); if (_selectedDataSetColumns.Length == 0) { SetImpossible($"Catalogue '{_catalogue}' in '{inConfiguration}' does not have any extractable columns"); return; } _alreadyMarkedInConfiguration = _selectedDataSetColumns.Where(ei => ei.IsExtractionIdentifier).ToArray(); } else { _extractionInformations = _catalogue.GetAllExtractionInformation(ExtractionCategory.Any); if (_extractionInformations.Length == 0) { SetImpossible("Catalogue does not have any extractable columns"); return; } _alreadyMarked = _extractionInformations.Where(ei => ei.IsExtractionIdentifier).ToArray(); } if (!string.IsNullOrWhiteSpace(column)) { toPick = column.Split(',', StringSplitOptions.RemoveEmptyEntries); } }
private IEnumerable <ISelectedDataSets> GetSelectedDataSets(IExtractionConfiguration configuration) { //are we only releasing some of the datasets? var onlySomeDatasets = _selectedDatasets.Where(sds => sds.ExtractionConfiguration_ID == configuration.ID).ToArray(); if (onlySomeDatasets.Any()) { return(onlySomeDatasets); } //no, we are releasing all of them return(configuration.SelectedDataSets); }
public ExecuteCommandOpenExtractionDirectory(IActivateItems activator, IExtractionConfiguration configuration) : base(activator) { var cumulativeExtractionResults = configuration.SelectedDataSets.Select(s => s.GetCumulativeExtractionResultsIfAny()).Where(c => c != null).ToArray(); try { if (cumulativeExtractionResults.Length == 0) { SetImpossible("No datasets have ever been extracted"); } else if (!cumulativeExtractionResults.All(c => c.DestinationType != null && c.DestinationType.EndsWith("FlatFileDestination"))) { SetImpossible("Extraction destinations were not to disk"); } else { // all datasets have been extracted to disk // but do they have a shared parent dir? var files = cumulativeExtractionResults.Select(c => new FileInfo(c.DestinationDescription)).ToArray(); var parents = files.Select(f => f.Directory?.Parent?.FullName).Where(d => d != null).Distinct().ToArray(); if (parents.Length != 1) { SetImpossible($"Extracted files do not share a common extraction directory"); } else { _dir = new DirectoryInfo(parents[0]); } } } catch (Exception) { SetImpossible("Could not determine file location"); } }