private ICommandExecution CreateWhenTargetIsFolder(ICommand cmd, CatalogueFolder targetCatalogueFolder) { var sourceCatalogue = cmd as CatalogueCommand; var sourceManyCatalogues = cmd as ManyCataloguesCommand; var file = cmd as FileCollectionCommand; if (sourceCatalogue != null) { return(new ExecuteCommandPutCatalogueIntoCatalogueFolder(_activator, sourceCatalogue, targetCatalogueFolder)); } if (sourceManyCatalogues != null) { return(new ExecuteCommandPutCatalogueIntoCatalogueFolder(_activator, sourceManyCatalogues, targetCatalogueFolder)); } if (file != null) { if (file.Files.Length == 1) { var toReturn = new ExecuteCommandCreateNewCatalogueByImportingFile(_activator, file.Files[0]); toReturn.TargetFolder = targetCatalogueFolder; return(toReturn); } } return(null); }
public CatalogueFolderMenu(RDMPContextMenuStripArgs args, CatalogueFolder folder) : base(args, folder) { //Things that are always visible regardless Add(new ExecuteCommandCreateNewCatalogueByImportingFile(_activator)); Add(new ExecuteCommandCreateNewCatalogueByImportingExistingDataTable(_activator)); Add(new ExecuteCommandCreateNewEmptyCatalogue(_activator)); }
public CatalogueFolderMenu(RDMPContextMenuStripArgs args, CatalogueFolder folder) : base(args, folder) { //Things that are always visible regardless Add(new ExecuteCommandCreateNewCatalogueByImportingFile(_activator)); Add(new ExecuteCommandCreateNewCatalogueByImportingExistingDataTable(_activator)); Add(new ExecuteCommandCreateNewEmptyCatalogue(_activator)); Add(new ExecuteCommandGenerateMetadataReport(_activator, _activator.CoreChildProvider.GetAllChildrenRecursively(folder).OfType <ICatalogue>().ToArray())); }
private void ExpandAllFolders(CatalogueFolder model) { //expand it tlvCatalogues.Expand(model); foreach (var folder in tlvCatalogues.GetChildren(model).OfType <CatalogueFolder>()) { ExpandAllFolders(folder); } }
public void CatalogueFolder_SubfolderingAdvanced() { var c1 = new Catalogue(Repository, "C1"); var c2 = new Catalogue(Repository, "C2"); var c3 = new Catalogue(Repository, "C3"); var c4 = new Catalogue(Repository, "C4"); var c5 = new Catalogue(Repository, "C5"); var c6 = new Catalogue(Repository, "C6"); // // Pass in // CatalogueA - \2005\Research\ // CatalogueB - \2006\Research\ // // This is Root (\) // Returns: // \2005\ - empty // \2006\ - empty // try { c1.Folder.Path = @"\2005\Research\Current"; c1.SaveToDatabase(); c2.Folder.Path = @"\2005\Research\Previous"; c2.SaveToDatabase(); c3.Folder.Path = @"\2001\Research\Current"; c3.SaveToDatabase(); c4.Folder.Path = @"\Homeland\Research\Current"; c4.SaveToDatabase(); c5.Folder.Path = @"\Homeland\Research\Current"; c5.SaveToDatabase(); c6.Folder.Path = @"\Homeland\Research\Current"; c6.SaveToDatabase(); var collection = new[] { c1, c2, c3, c4, c5, c6 }; var results = CatalogueFolder.Root.GetImmediateSubFoldersUsing(collection); Assert.AreEqual(3, results.Length); CatalogueFolder TwoThousandFive = results.Single(f => f.Path.Equals(@"\2005\")); CatalogueFolder TwoThousandOne = results.Single(f => f.Path.Equals(@"\2001\")); CatalogueFolder Homeland = results.Single(f => f.Path.Equals(@"\homeland\")); Assert.AreEqual(1, Homeland.GetImmediateSubFoldersUsing(collection).Length); Assert.AreEqual(1, Homeland.GetImmediateSubFoldersUsing(collection).Count(f => f.Path.Equals(@"\homeland\research\"))); Assert.AreEqual(1, TwoThousandOne.GetImmediateSubFoldersUsing(collection).Length); Assert.AreEqual(1, TwoThousandOne.GetImmediateSubFoldersUsing(collection).Count(f => f.Path.Equals(@"\2001\research\"))); CatalogueFolder[] finalResult = TwoThousandFive.GetImmediateSubFoldersUsing(collection).Single().GetImmediateSubFoldersUsing(collection); Assert.AreEqual(2, finalResult.Length); Assert.AreEqual(1, finalResult.Count(c => c.Path.Equals(@"\2005\research\current\"))); Assert.AreEqual(1, finalResult.Count(c => c.Path.Equals(@"\2005\research\previous\"))); Assert.AreEqual(0, finalResult[0].GetImmediateSubFoldersUsing(collection).Length); } finally { c1.DeleteInDatabase(); c2.DeleteInDatabase(); c3.DeleteInDatabase(); c4.DeleteInDatabase(); c5.DeleteInDatabase(); c6.DeleteInDatabase(); } }
public override ICatalogue CreateAndConfigureCatalogue(ITableInfo tableInfo, ColumnInfo[] extractionIdentifierColumns, string initialDescription, IProject projectSpecific, CatalogueFolder folder) { var ui = new ConfigureCatalogueExtractabilityUI(this, tableInfo, initialDescription, projectSpecific); ui.TargetFolder = folder; ui.ShowDialog(); return(ui.CatalogueCreatedIfAny); }
private ExecuteCommandPutCatalogueIntoCatalogueFolder(IActivateItems activator, Catalogue[] catalogues, CatalogueFolder targetModel) : base(activator) { _targetModel = targetModel; _catalogues = catalogues; }
public ExecuteCommandPutCatalogueIntoCatalogueFolder(IActivateItems activator, ManyCataloguesCommand cmd, CatalogueFolder targetModel) : this(activator, cmd.Catalogues, targetModel) { }
public ExecuteCommandPutCatalogueIntoCatalogueFolder(IActivateItems activator, CatalogueCommand cmd, CatalogueFolder targetModel) : this(activator, new [] { cmd.Catalogue }, targetModel) { }
protected CatalogueCreationCommandExecution(IBasicActivateItems activator, IProject projectSpecific, CatalogueFolder targetFolder) : base(activator) { ProjectSpecific = projectSpecific; TargetFolder = targetFolder; }
/// <inheritdoc/> public virtual ICatalogue CreateAndConfigureCatalogue(ITableInfo tableInfo, ColumnInfo[] extractionIdentifierColumns, string initialDescription, IProject projectSpecific, CatalogueFolder catalogueFolder) { // Create a new Catalogue based on the table info var engineer = new ForwardEngineerCatalogue(tableInfo, tableInfo.ColumnInfos, true); engineer.ExecuteForwardEngineering(out ICatalogue cata, out _, out ExtractionInformation[] eis); // if we know the linkable private identifier column(s) if (extractionIdentifierColumns != null && extractionIdentifierColumns.Any()) { // Make the Catalogue extractable var eds = new ExtractableDataSet(RepositoryLocator.DataExportRepository, cata); // Mark the columns specified IsExtractionIdentifier foreach (var col in extractionIdentifierColumns) { var match = eis.FirstOrDefault(ei => ei.ColumnInfo?.ID == col.ID); if (match == null) { throw new ArgumentException($"Supplied ColumnInfo {col.GetRuntimeName()} was not found amongst the columns created"); } match.IsExtractionIdentifier = true; match.SaveToDatabase(); } // Catalogue must be extractable to be project specific if (projectSpecific != null) { eds.Project_ID = projectSpecific.ID; eds.SaveToDatabase(); } } if (catalogueFolder != null) { cata.Folder = catalogueFolder; cata.SaveToDatabase(); } return(cata); }