Exemple #1
0
        private void NewInspireDatasetFromKartkatalogen(InspireDataset inspireDataset, Synchronize synchronizationJob)
        {
            if (!_registerItemService.ItemNameIsValid(inspireDataset))
            {
                synchronizationJob.FailCount++;
                synchronizationJob.FailLog.Add(new SyncLogEntry(inspireDataset, "Navn finnes fra før"));
                return;
            }

            inspireDataset.SystemId      = Guid.NewGuid();
            inspireDataset.Seoname       = RegisterUrls.MakeSeoFriendlyString(inspireDataset.Name);
            inspireDataset.SubmitterId   = _registerService.GetOrganizationIdByUserName();
            inspireDataset.DateSubmitted = DateTime.Now;
            inspireDataset.Modified      = DateTime.Now;
            inspireDataset.RegisterId    = _registerService.GetInspireStatusRegisterId();
            inspireDataset.VersioningId  = _registerItemService.NewVersioningGroup(inspireDataset);
            inspireDataset.VersionNumber = 1;
            inspireDataset.StatusId      = "Submitted";
            inspireDataset.DokStatusId   = "Proposal";

            //GetDeliveryStatuses(inspireDatasetViewModel, inspireDataset);
            var metadataStatus             = _datasetDeliveryService.GetMetadataStatus(inspireDataset.Uuid);
            var metadataServiceStatus      = "good";
            var distributionStatus         = _datasetDeliveryService.GetDeliveryDistributionStatus(inspireDataset.Uuid, inspireDataset.DistributionUrl);
            var wmsStatus                  = _datasetDeliveryService.GetInspireWmsStatus(inspireDataset.Uuid, true, "deficient", inspireDataset.UuidService);
            var wfsStatus                  = _datasetDeliveryService.GetInspireWfsStatus(inspireDataset.Uuid);
            var atomFeedStatus             = _datasetDeliveryService.GetAtomFeedStatus(inspireDataset.Uuid);
            var wfsOrAtomStatus            = _datasetDeliveryService.GetDownloadRequirementsStatus(wfsStatus, atomFeedStatus);
            var harmonizedDataStatus       = _datasetDeliveryService.GetHarmonizedStatus(inspireDataset.Uuid);
            var spatialDataServiceStatusId = _datasetDeliveryService.GetSpatialDataStatus(inspireDataset.Uuid);

            inspireDataset.InspireDeliveryMetadataId           = _datasetDeliveryService.CreateDatasetDelivery(metadataStatus);
            inspireDataset.InspireDeliveryMetadataServiceId    = _datasetDeliveryService.CreateDatasetDelivery(metadataServiceStatus);
            inspireDataset.InspireDeliveryDistributionId       = _datasetDeliveryService.CreateDatasetDelivery(distributionStatus);
            inspireDataset.InspireDeliveryWmsId                = _datasetDeliveryService.CreateDatasetDelivery(wmsStatus);
            inspireDataset.InspireDeliveryWfsId                = _datasetDeliveryService.CreateDatasetDelivery(wfsStatus);
            inspireDataset.InspireDeliveryAtomFeedId           = _datasetDeliveryService.CreateDatasetDelivery(atomFeedStatus);
            inspireDataset.InspireDeliveryWfsOrAtomId          = _datasetDeliveryService.CreateDatasetDelivery(wfsOrAtomStatus);
            inspireDataset.InspireDeliveryHarmonizedDataId     = _datasetDeliveryService.CreateDatasetDelivery(harmonizedDataStatus);
            inspireDataset.InspireDeliverySpatialDataServiceId = _datasetDeliveryService.CreateDatasetDelivery(spatialDataServiceStatusId);

            synchronizationJob.AddedLog.Add(new SyncLogEntry(inspireDataset, "Lagt til"));
            _dbContext.InspireDatasets.Add(inspireDataset);
            _dbContext.SaveChanges();
        }