Changes changes = new Changes();
StandardGuide[] localGuides = aLocalSet.getStandardGuides(null);
StandardGuide[] remoteGuides = aRemoteSet.getStandardGuides(null);
DeletedObjectsRepository dfr = GlobalController.SINGLETON.getDeletedFeedsRepository();
// Scan through remote guides and verify each guide user has.
// If user has no some guide then put the guide in the list
// of guides to add. If user has the guide, verify its contents.
// Later we could scan the lists of guides for addition and
// guides for removal in order to detect the renaming.
for (StandardGuide remoteGuide : remoteGuides)
{
String remoteGuideTitle = remoteGuide.getTitle();
StandardGuide localGuide = findGuideByName(localGuides, remoteGuideTitle);
if (localGuide == null)
{
// There's no guide with such name locally -- add feeds that weren't removed
for (int j = 0; j < remoteGuide.getFeedsCount(); j++)
{
IFeed feed = remoteGuide.getFeedAt(j);
if (remoteGuide.hasDirectLinkWith(feed) &&
(copyServiceLayout || !dfr.wasDeleted(remoteGuideTitle, feed.getMatchKey())))
changes.addFeed(feed);
}
// Reading lists
ReadingList[] readingLists = remoteGuide.getReadingLists();
for (ReadingList rl : readingLists)
{
if (copyServiceLayout || !dfr.wasDeleted(remoteGuideTitle, rl.getURL().toString()))
changes.addReadingList(rl);
}
} else
{
if (localGuide.getLastUpdateTime() < remoteGuide.getLastUpdateTime())