public async Task <ConnectorEvent> PublishAsync(Entity channel) { ConnectorEvent publishEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.Publish, $"Publish started for channel: {channel.DisplayName.Data}", 0); ConnectorEventHelper.UpdateEvent(publishEvent, "Fetching all channel entities...", 1); List <StructureEntity> channelStructureEntities = _entityService.GetAllStructureEntitiesInChannel(_config.ExportEnabledEntityTypes); ConnectorEventHelper.UpdateEvent(publishEvent, "Fetched all channel entities. Generating catalog.xml...", 10); CatalogElementContainer epiElements = await _catalogDocumentFactory.GetEPiElementsAsync(channelStructureEntities); XElement metaClasses = _catalogElementFactory.GetMetaClassesFromFieldSets(); XElement associationTypes = _catalogDocumentFactory.GetAssociationTypes(); XDocument catalogDocument = _catalogDocumentFactory.CreateImportDocument(channel, metaClasses, associationTypes, epiElements); LogCatalogProperties(epiElements); List <StructureEntity> resourceEntities = RemoteManager.ChannelService.GetAllChannelStructureEntitiesForTypeFromPath(channel.Id.ToString(), "Resource"); await PublishToEpiserverAsync(publishEvent, catalogDocument, resourceEntities, channel); return(publishEvent); }
private static void LogCatalogProperties(CatalogElementContainer epiElements) { IntegrationLogger.Write(LogLevel.Information, $"Catalog saved with the following: " + $"Nodes: {epiElements.Nodes.Count}. " + $"Entries: {epiElements.Entries.Count}. " + $"Relations: {epiElements.Relations.Count}. " + $"Associations: {epiElements.Associations.Count}. "); }
internal void PublishEntities(Entity channel, ConnectorEvent connectorEvent, List <StructureEntity> structureEntities) { ConnectorEventHelper.UpdateEvent(connectorEvent, "Generating catalog.xml...", 11); CatalogElementContainer epiElements = _catalogDocumentFactory.GetEPiElements(structureEntities); XDocument catalogDocument = _catalogDocumentFactory.CreateImportDocument(channel, null, null, epiElements); LogCatalogProperties(epiElements); PubilshToEpiserver(connectorEvent, catalogDocument, structureEntities, channel); }