Example #1
0
        /// <summary>
        /// Overridden to migrate an item.
        /// Base implementation just return the <paramref name="newsItem"/>.
        /// </summary>
        /// <param name="newsItem">The news item.</param>
        /// <param name="migratedItemsOwner">The migrated items owner.</param>
        /// <returns></returns>
        protected override NewsItem MigrateItem(NewsItem newsItem, FeedSourceEntry migratedItemsOwner)
        {
            if (migratedItemsOwner != null)
            {
                if (runSelfHealingFlagStatus)
                {
                    if (newsItem.FlagStatus == Flagged.None)
                    {
                        // correction: older Bandit versions are not able to store flagStatus
                        newsItem.FlagStatus = Flagged.FollowUp;
                        Modified            = true;
                    }
                }

                XmlQualifiedName key = AdditionalElements.GetQualifiedName(
                    OptionalItemElement.OldVersion.FeedUrlElementName, OptionalItemElement.OldVersion.Namespace);
                string feedUrl = AdditionalElements.GetElementValue(key, newsItem);
                if (!String.IsNullOrEmpty(feedUrl))
                {
                    if (runSelfHealingFlagStatus && migratedItemsOwner.Source.IsSubscribed(feedUrl))
                    {
                        //check if feed exists
                        IList <INewsItem> itemsForFeed = migratedItemsOwner.Source.GetItemsForFeed(feedUrl, false);

                        //find this item
                        int itemIndex = itemsForFeed.IndexOf(newsItem);

                        if (itemIndex != -1)
                        {
                            //check if item still exists
                            INewsItem item = itemsForFeed[itemIndex];
                            if (item.FlagStatus != newsItem.FlagStatus)
                            {
                                // correction: older Bandit versions are not able to store flagStatus
                                item.FlagStatus = newsItem.FlagStatus;
                                Modified        = true;
                                //FeedWasModified(feedUrl, NewsFeedProperty.FeedItemFlag); // self-healing
                            }
                        }
                    }

                    AdditionalElements.RemoveElement(key, newsItem);
                    OptionalItemElement.AddOrReplaceOriginalFeedReference(newsItem, feedUrl, migratedItemsOwner.ID);
                    Modified = true;
                }
            }

            return(base.MigrateItem(newsItem, migratedItemsOwner));
        }
Example #2
0
 /// <summary>
 /// Overridden to migrate an item.
 /// Base implementation just return the <paramref name="newsItem"/>.
 /// </summary>
 /// <param name="newsItem">The news item.</param>
 /// <param name="migratedItemsOwner">The migrated items owner.</param>
 /// <returns></returns>
 protected override NewsItem MigrateItem(NewsItem newsItem, FeedSourceEntry migratedItemsOwner)
 {
     if (migratedItemsOwner != null)
     {
         XmlQualifiedName key =
             AdditionalElements.GetQualifiedName(
                 OptionalItemElement.OldVersion.ContainerUrlElementName, OptionalItemElement.OldVersion.Namespace);
         string feedUrl = AdditionalElements.GetElementValue(key, newsItem);
         if (!String.IsNullOrEmpty(feedUrl))
         {
             AdditionalElements.RemoveElement(key, newsItem);
             OptionalItemElement.AddOrReplaceOriginalFeedReference(newsItem, feedUrl, migratedItemsOwner.ID);
             Modified = true;
         }
     }
     return(base.MigrateItem(newsItem, migratedItemsOwner));
 }
Example #3
0
            private void InitWith(ExceptionManager ownerFeed, Exception e, string categoryName)
            {
                FeedInfo fi = new FeedInfo(null, String.Empty, ownerFeed.Items, ownerFeed.title, ownerFeed.link, ownerFeed.Description);
                // to prevent confusing about daylight saving time and to work similar to RssComponts, that save item DateTime's
                // as GMT, we convert DateTime to universal to be conform
                DateTime exDT             = new DateTime(DateTime.Now.Ticks).ToUniversalTime();
                bool     enableValidation = (e is XmlException);

                string link = this.BuildBaseLink(e, enableValidation);

                _delegateTo = new NewsItem(ownerFeed, this._feedTitle, link,
                                           this.BuildBaseDesc(e, enableValidation),
                                           exDT, categoryName,
                                           ContentType.Xhtml, new Dictionary <XmlQualifiedName, string>(1), link, null);

                _delegateTo.FeedDetails = fi;
                _delegateTo.BeenRead    = false;
                OptionalItemElement.AddOrReplaceOriginalFeedReference(
                    _delegateTo, this._resourceUrl, this._feedSourceID);
            }