*
* @param blog a Blog instance
*/
public static void buildIpAddressLists(Blog blog) {
Iterator blogEntries = blog.getBlogEntries().iterator();
IpAddressListener ipAddressListener = new IpAddressListener();
while (blogEntries.hasNext()) {
BlogEntry blogEntry = (BlogEntry)blogEntries.next();
log.info("Processing " + blogEntry.getTitle() + " (" + blogEntry.getDate() + ")");
Iterator comments = blogEntry.getComments().iterator();
while (comments.hasNext()) {
Comment comment = (Comment)comments.next();
if (comment.isApproved()) {
CommentEvent event = new CommentEvent(comment, CommentEvent.COMMENT_APPROVED);
ipAddressListener.commentApproved(event);
} else if (comment.isRejected()) {
CommentEvent event = new CommentEvent(comment, CommentEvent.COMMENT_REJECTED);
ipAddressListener.commentRejected(event);
}
}
Iterator trackbacks = blogEntry.getTrackBacks().iterator();
while (trackbacks.hasNext()) {
TrackBack trackback = (TrackBack)trackbacks.next();
if (trackback.isApproved()) {
TrackBackEvent event = new TrackBackEvent(trackback, TrackBackEvent.TRACKBACK_APPROVED);
ipAddressListener.trackBackApproved(event);
} else if (trackback.isRejected()) {
TrackBackEvent event = new TrackBackEvent(trackback, TrackBackEvent.TRACKBACK_REJECTED);
ipAddressListener.trackBackRejected(event);
}
}
//
// try {
// blogEntry.store();