コード例 #1
0
        private void SetCatalogue(ICatalogue catalogue)
        {
            ResetImpossibleness();

            _catalogue = catalogue;

            if (catalogue == null)
            {
                SetImpossible("Catalogue cannot be null");
                return;
            }

            var status = _catalogue.GetExtractabilityStatus(BasicActivator.RepositoryLocator.DataExportRepository);

            if (status.IsProjectSpecific)
            {
                SetImpossible("Catalogue is already Project Specific");
            }

            if (!status.IsExtractable)
            {
                SetImpossible("Catalogue must first be made Extractable");
            }

            var ei = _catalogue.GetAllExtractionInformation(ExtractionCategory.Any);

            if (!ei.Any())
            {
                SetImpossible("Catalogue has no extractable columns");
            }

            if (ei.Count(e => e.IsExtractionIdentifier) != 1)
            {
                SetImpossible("Catalogue must have exactly 1 IsExtractionIdentifier column");
            }

            if (ei.Any(e => e.ExtractionCategory != ExtractionCategory.Core && e.ExtractionCategory != ExtractionCategory.ProjectSpecific))
            {
                SetImpossible("All existing ExtractionInformations must be ExtractionCategory.Core");
            }
        }