EPiServer Integration

EPiServer integration is handled by OpenWaves.ActivityFeed.EPiServer NuGet package. The package adds a dll that contains an initialization module that hooks to DataFactory.Instance.PagePublished event.

The event is handled by IActivityFeedEPiServerConnector service resolved using ServiceLocator.

Default implementation of the service publishes updates with content type "page", extracting topics from page.Category, using page.PageName as Title and Description. This behavior can be changed by registering a custom implementation of the service with ServiceLocator (or IoC container if used as service resolver).

ServiceLocator.SetResolver(new BasicResolver()
    .Register<IActivityFeedEPiServerConnector>(new MyEPiConnector())); 

public class MyEPiConnector : ActivityFeedEPiServerConnector
{
        public override void OnPagePublished(PageData page)
        {
               // Default implementation publishes an update
               // with properties initialized using protected methods below.
               // This is where you can decide if you want to publish
               // an update for a given page by calling base implementation.
               base.OnPagePublished(page);
        }

        protected override IEnumerable<string> GetUserGroups(PageData page)
        {
            // Default implementation returns roles and users with
            // read access to the page
            return base.GetUserGroups(page)
        }

        protected override IEnumerable<Topic> GetTopics(PageData page)
        {
            // Default implementation returns categories and publisher
            return base.GetTopics(page);
        }

        protected override UpdateContent GetUpdateContent(PageData page)
        {
            // Default implementation returns new Page() with
            // Title set to page.PageName
            return base.GetUpdateContent(page);
        }

        protected override string GetSource(PageData page)
        {
            // Default implementation returns "EPiServer"
            return base.GetSource(page);
        }
}

Last edited Jun 27, 2012 at 2:00 PM by mgrzyb, version 8

Comments

No comments yet.