예제 #1
0
        protected override object[] GetRunnables()
        {
            lock (_oLock)
                ExtractCommands.Clear();

            var commands = new List <IExtractCommand>();

            //if we are extracting globals
            if (_options.ExtractGlobals)
            {
                var g       = _configuration.GetGlobals();
                var globals = new GlobalsBundle(g.OfType <SupportingDocument>().ToArray(), g.OfType <SupportingSQLTable>().ToArray());
                _globalsCommand = new ExtractGlobalsCommand(RepositoryLocator, _project, _configuration, globals);
                commands.Add(_globalsCommand);
            }

            var factory = new ExtractCommandCollectionFactory();

            foreach (ISelectedDataSets sds in GetSelectedDataSets())
            {
                var extractDatasetCommand = factory.Create(RepositoryLocator, sds);
                commands.Add(extractDatasetCommand);

                lock (_oLock)
                    ExtractCommands.Add(sds, extractDatasetCommand);
            }

            return(commands.ToArray());
        }
예제 #2
0
        public void Setup(ExtractionConfiguration configuration)
        {
            olvColumn1.ImageGetter += ImageGetter;

            Categories.Clear();
            Categories.Add(ExtractionDirectory.GLOBALS_DATA_NAME, new List <object>());
            Categories.Add(Bundles, new List <object>());

            var factory    = new ExtractCommandCollectionFactory();
            var collection = factory.Create(Activator.RepositoryLocator, configuration);

            //find all the things that are available for extraction

            //add globals to the globals category
            Categories[ExtractionDirectory.GLOBALS_DATA_NAME].AddRange(Activator.RepositoryLocator.CatalogueRepository.GetAllObjects <SupportingDocument>().Where(d => d.IsGlobal && d.Extractable));

            //add global SQLs to globals category
            Categories[ExtractionDirectory.GLOBALS_DATA_NAME].AddRange(Activator.RepositoryLocator.CatalogueRepository.GetAllObjects <SupportingSQLTable>().Where(s => s.IsGlobal && s.Extractable));

            //add the bundle
            Categories[Bundles].AddRange(collection.Datasets);

            tlvDatasets.SetObjects(Categories.Keys);

            //Can expand dataset bundles and also can expand strings for which the dictionary has a key for that string (i.e. the strings "Custom Tables" etc)
            tlvDatasets.CanExpandGetter = x => x is ExtractDatasetCommand || (x is string && Categories.ContainsKey((string)x));
            tlvDatasets.ChildrenGetter += ChildrenGetter;

            tlvDatasets.CheckAll();

            tlvDatasets.ExpandAll();

            foreach (IExtractDatasetCommand eds in Categories[Bundles])
            {
                if (eds.DatasetBundle.DataSet.DisableExtraction)
                {
                    tlvDatasets.UncheckObject(eds);
                }
            }
        }