public CatalogElementFactory(IConfiguration config, EpiMappingHelper mappingHelper, CatalogCodeGenerator catalogCodeGenerator, PimFieldAdapter pimFieldAdapter) { _config = config; _mappingHelper = mappingHelper; _catalogCodeGenerator = catalogCodeGenerator; _pimFieldAdapter = pimFieldAdapter; }
public EpiMappingHelperTests() { _config = new Mock <IConfiguration>(); var pimFieldAdapter = new Mock <IPimFieldAdapter>(); _epiMappingHelper = new EpiMappingHelper(_config.Object, pimFieldAdapter.Object); }
public EntityService(IConfiguration config, EpiMappingHelper mappingHelper) { _config = config; _mappingHelper = mappingHelper; _cachedEntities = new List <Entity>(); _cachedChannelNodeStructureEntities = new Dictionary <string, List <StructureEntity> >(); _cachedParentEntities = new Dictionary <int, Entity>(); }
public new void Start() { ConnectorEvent startEvent = null; try { _config = new Configuration(Id); ConnectorEventHelper.CleanupOngoingEvents(_config); startEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.Start, "Connector is starting", 0); Entity channel = RemoteManager.DataService.GetEntity(_config.ChannelId, LoadLevel.Shallow); if (channel == null || channel.EntityType.Id != "Channel") { _started = false; ConnectorEventHelper.UpdateEvent(startEvent, "Channel id is not valid: Entity with given ID is not a channel, or doesn't exist. Unable to start", -1, true); return; } _pimFieldAdapter = new PimFieldAdapter(_config); _epiMappingHelper = new EpiMappingHelper(_config, _pimFieldAdapter); _entityService = new EntityService(_config, _epiMappingHelper); _catalogCodeGenerator = new CatalogCodeGenerator(_config, _entityService); _epiApi = new EpiApi(_config, _catalogCodeGenerator, _pimFieldAdapter); _catalogElementFactory = new CatalogElementFactory(_config, _epiMappingHelper, _catalogCodeGenerator, _pimFieldAdapter); _channelHelper = new ChannelHelper(_config, _entityService); _catalogDocumentFactory = new CatalogDocumentFactory(_config, _epiApi, _catalogElementFactory, _epiMappingHelper, _channelHelper, _catalogCodeGenerator, _entityService); _resourceElementFactory = new ResourceElementFactory(_catalogElementFactory, _epiMappingHelper, _catalogCodeGenerator, _config, _entityService); _documentFileHelper = new DocumentFileHelper(_config, _channelHelper); _cvlUpdater = new CvlUpdater(_config, _catalogDocumentFactory, _epiApi, _documentFileHelper); _publisher = new ChannelPublisher(_config, _catalogDocumentFactory, _catalogElementFactory, _resourceElementFactory, _epiApi, _epiMappingHelper, _documentFileHelper, _pimFieldAdapter, _entityService, _catalogCodeGenerator); AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainAssemblyResolve; InitConnector(); base.Start(); _started = true; ConnectorEventHelper.UpdateEvent(startEvent, "Connector has started", 100); } catch (Exception ex) { IntegrationLogger.Write(LogLevel.Error, "Error while starting connector", ex); ConnectorEventHelper.UpdateEvent(startEvent, "Issue while starting connector, see log.", 100, true); throw; } }
public EpiDocument(inRiverContext context, Configuration configuration) { _context = context; _epiElement = new EpiElement(context); _channelHelper = new ChannelHelper(context); _epiMappingHelper = new EpiMappingHelper(context); _configuration = configuration; _epiApi = new EpiApi(context); }
public void UpdateEntryRelations(string catalogEntryId, int channelId, Entity channelEntity, Configuration config, string parentId, Dictionary <string, bool> shouldExistInChannelNodes, string linkTypeId, List <string> linkEntityIdsToRemove) { lock (SingletonEPiLock.Instance) { try { string channelName = _businessHelper.GetDisplayNameFromEntity(channelEntity, config, -1); List <string> removeFromChannelNodes = new List <string>(); foreach (KeyValuePair <string, bool> shouldExistInChannelNode in shouldExistInChannelNodes) { if (!shouldExistInChannelNode.Value) { removeFromChannelNodes.Add( _channelPrefixHelper.GetEPiCodeWithChannelPrefix(shouldExistInChannelNode.Key, config)); } } var channelMappingHelper = new EpiMappingHelper(_context); string parentEntryId = _channelPrefixHelper.GetEPiCodeWithChannelPrefix(parentId, config); string catalogEntryIdString = _channelPrefixHelper.GetEPiCodeWithChannelPrefix(catalogEntryId, config); string channelIdEpified = _channelPrefixHelper.GetEPiCodeWithChannelPrefix(channelId, config); string inriverAssociationsEpified = _channelPrefixHelper.GetEPiCodeWithChannelPrefix("_inRiverAssociations", config); bool relation = channelMappingHelper.IsRelation(linkTypeId, config); bool parentExistsInChannelNodes = shouldExistInChannelNodes.Keys.Contains(parentId); UpdateEntryRelationData updateEntryRelationData = new UpdateEntryRelationData { ParentEntryId = parentEntryId, CatalogEntryIdString = catalogEntryIdString, ChannelIdEpified = channelIdEpified, ChannelName = channelName, RemoveFromChannelNodes = removeFromChannelNodes, LinkEntityIdsToRemove = linkEntityIdsToRemove, InRiverAssociationsEpified = inriverAssociationsEpified, LinkTypeId = linkTypeId, IsRelation = relation, ParentExistsInChannelNodes = parentExistsInChannelNodes }; RestEndpoint <UpdateEntryRelationData> endpoint = new RestEndpoint <UpdateEntryRelationData>(config.Settings, "UpdateEntryRelations", this._context); endpoint.Post(updateEntryRelationData); } catch (Exception exception) { string parentEntryId = _channelPrefixHelper.GetEPiCodeWithChannelPrefix(parentId, config); string childEntryId = _channelPrefixHelper.GetEPiCodeWithChannelPrefix(catalogEntryId, config); _context.Log( LogLevel.Error, string.Format("Failed to update entry relations between parent entry id {0} and child entry id {1} in catalog with id {2}", parentEntryId, childEntryId, catalogEntryId), exception); } } }
public CvlUtility(Configuration cvlUtilConfig, inRiverContext inRiverContext) { CvlUtilConfig = cvlUtilConfig; _context = inRiverContext; _epiElement = new EpiElement(inRiverContext); _epiMappingHelper = new EpiMappingHelper(inRiverContext); _businessHelper = new BusinessHelper(_context); _epiDocument = new EpiDocument(_context, cvlUtilConfig); _channelHelper = new ChannelHelper(_context); _epiApi = new EpiApi(_context); }
public ResourceElementFactory(CatalogElementFactory catalogElementFactory, EpiMappingHelper mappingHelper, CatalogCodeGenerator catalogCodeGenerator, IConfiguration config, IEntityService entityService) { _catalogElementFactory = catalogElementFactory; _mappingHelper = mappingHelper; _catalogCodeGenerator = catalogCodeGenerator; _config = config; _entityService = entityService; _isImageCache = new Dictionary <string, bool>(); }
public CatalogDocumentFactory(IConfiguration config, EpiApi epiApi, CatalogElementFactory catalogElementFactory, EpiMappingHelper epiMappingHelper, ChannelHelper channelHelper, CatalogCodeGenerator catalogCodeGenerator, IEntityService entityService) { _config = config; _epiApi = epiApi; _catalogElementFactory = catalogElementFactory; _epiMappingHelper = epiMappingHelper; _channelHelper = channelHelper; _catalogCodeGenerator = catalogCodeGenerator; _entityService = entityService; }
public new void Stop() { base.Stop(); var connectorEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.Stop, "Connector is stopping", 0); _started = false; _epiApi = null; _catalogElementFactory = null; _catalogDocumentFactory = null; _channelHelper = null; _resourceElementFactory = null; _epiMappingHelper = null; _catalogCodeGenerator = null; _publisher = null; _config = null; _documentFileHelper = null; _entityService = null; _cvlUpdater = null; ConnectorEventHelper.UpdateEvent(connectorEvent, "Connector has stopped.", 100); }
public ChannelPublisher(IConfiguration config, CatalogDocumentFactory catalogDocumentFactory, CatalogElementFactory catalogElementFactory, ResourceElementFactory resourceElementFactory, EpiApi epiApi, EpiMappingHelper mappingHelper, DocumentFileHelper documentFileHelper, PimFieldAdapter pimFieldAdapter, IEntityService entityService, CatalogCodeGenerator catalogCodeGenerator) { _config = config; _catalogDocumentFactory = catalogDocumentFactory; _catalogElementFactory = catalogElementFactory; _resourceElementFactory = resourceElementFactory; _epiApi = epiApi; _mappingHelper = mappingHelper; _documentFileHelper = documentFileHelper; _pimFieldAdapter = pimFieldAdapter; _entityService = entityService; _catalogCodeGenerator = catalogCodeGenerator; }