logger.debug("SaveBookmarkEntryRunnable run() starts");
try{
boolean doReplace = shouldRepalceOnChange(srcFeed);
logger.debug("On Change Do Repalce: " + doReplace + " feed: " + srcFeed.getBookmark().getLink().getUrl());
for(BookmarkEntry entry : entries){
Bookmark bm = entry.getBookmark();
int oldBmId = bookmarkManager.getBookmarkId(bm.getUser(),bm.getLink().getUrl());
if(oldBmId > 0 && doReplace == true){
logger.debug("old bookmark exists.");
Bookmark oldBm = bookmarkManager.getBookmark(oldBmId);
Date oldBmLastUpdated = oldBm.getLastUpdated();
Date newBmLastUpdated = bm.getLastUpdated();
if(oldBmLastUpdated != null && newBmLastUpdated != null &&
oldBmLastUpdated.before(newBmLastUpdated) == true){
if(bookmarkManager.deleteBookmark(new Bookmark(oldBmId)) == false){
logger.error("unable to delete bookmark of id: " + oldBmId);
continue;
}
logger.debug("deleted on old bookmark before add it as a new");
oldBmId = 0;