// add feed url to the "live" list
liveUserFeeds.add(feedUrl);
// if sub already exists then update it, otherwise add it
PlanetSubscriptionData sub = planet.getSubscription(feedUrl);
if (sub == null) {
log.info("ADDING feed: "+feedUrl);
sub = new PlanetSubscriptionData();
sub.setTitle(weblog.getName());
sub.setFeedURL(feedUrl);
sub.setSiteURL(siteUrl);
sub.setAuthor(weblog.getHandle());
planet.saveSubscription(sub);
group.getSubscriptions().add(sub);
} else {
sub.setTitle(weblog.getName());
sub.setAuthor(weblog.getHandle());
planet.saveSubscription(sub);
}
}
// new subs added, existing subs updated, now delete old subs
Iterator subs = group.getSubscriptions().iterator();
while(subs.hasNext()) {
PlanetSubscriptionData sub =
(PlanetSubscriptionData) subs.next();
if (!liveUserFeeds.contains(sub.getFeedURL())) {
log.info("DELETING feed: "+sub.getFeedURL());
planet.deleteSubscription(sub);
group.getSubscriptions().remove(sub);
}
}