/* Notify about Bookmark getting loaded */
fireBookMarkAboutToLoad(bookmark);
/* Load Conditional Get for the URL */
IConditionalGet conditionalGet = fConditionalGetDAO.load(feedLink);
/* Define Properties for Connection */
if (properties == null)
properties = new HashMap<Object, Object>();
properties.put(IConnectionPropertyConstants.CON_TIMEOUT, fConnectionTimeout);
/* Sync Specific Item Limit derived from retention settings */
if (SyncUtils.isSynchronized(bookmark)) {
IPreferenceScope defaultPreferences = Owl.getPreferenceService().getDefaultScope();
IPreferenceScope preferences = Owl.getPreferenceService().getEntityScope(bookmark);
/* Item Limit */
int itemLimit;
if (preferences.getBoolean(DefaultPreferences.DEL_NEWS_BY_COUNT_STATE))
itemLimit = preferences.getInteger(DefaultPreferences.DEL_NEWS_BY_COUNT_VALUE);
else
itemLimit = defaultPreferences.getInteger(DefaultPreferences.DEL_NEWS_BY_COUNT_VALUE);
properties.put(IConnectionPropertyConstants.ITEM_LIMIT, itemLimit);
/* Date Limit */
long dateLimit = 0;
if (preferences.getBoolean(DefaultPreferences.DEL_NEWS_BY_AGE_STATE)) {
int days = preferences.getInteger(DefaultPreferences.DEL_NEWS_BY_AGE_VALUE);
dateLimit = DateUtils.getToday().getTimeInMillis() - (days * DateUtils.DAY);
}
if (dateLimit != 0)
properties.put(IConnectionPropertyConstants.DATE_LIMIT, dateLimit);
/* Uncommitted Synchronized Items */
if (fSyncService != null)
properties.put(IConnectionPropertyConstants.UNCOMMITTED_ITEMS, fSyncService.getUncommittedItems());
}
/* Add Conditional GET Headers if present */
if (conditionalGet != null) {
String ifModifiedSince = conditionalGet.getIfModifiedSince();
if (ifModifiedSince != null)
properties.put(IConnectionPropertyConstants.IF_MODIFIED_SINCE, ifModifiedSince);
String ifNoneMatch = conditionalGet.getIfNoneMatch();
if (ifNoneMatch != null)
properties.put(IConnectionPropertyConstants.IF_NONE_MATCH, ifNoneMatch);
}
/* Return on Cancelation or shutdown or deletion */
if (!shouldProceedReloading(monitor, bookmark))
return Status.CANCEL_STATUS;
/* Load the Feed */
final Triple<IFeed, IConditionalGet, URI> result = Owl.getConnectionService().reload(feedLink, monitor, properties);
/* Return on Cancelation or shutdown or deletion */
if (!shouldProceedReloading(monitor, bookmark) || result == null)
return Status.CANCEL_STATUS;
/* Remember Homepage of feed */
feedHomepage = result.getFirst().getHomepage();
/* Update ConditionalGet Entity */
boolean conditionalGetIsNull = (conditionalGet == null);
conditionalGet = updateConditionalGet(feedLink, conditionalGet, result.getSecond());
boolean deleteConditionalGet = (!conditionalGetIsNull && conditionalGet == null);
/* Return on Cancelation or shutdown or deletion */
if (!shouldProceedReloading(monitor, bookmark))
return Status.CANCEL_STATUS;
/* Load the Favicon directly afterwards if required */
if (!InternalOwl.PERF_TESTING && OwlUI.getFavicon(bookmark) == null)
loadFavicon(bookmark, monitor, result.getThird(), feedHomepage);
/* Return on Cancelation or shutdown or deletion */
if (!shouldProceedReloading(monitor, bookmark))
return Status.CANCEL_STATUS;
/* Merge and Save Feed */
if (!InternalOwl.TESTING) {
final IConditionalGet finalConditionalGet = conditionalGet;
final boolean finalDeleteConditionalGet = deleteConditionalGet;
fSaveFeedQueue.schedule(new TaskAdapter() {
public IStatus run(IProgressMonitor otherMonitor) {
/* Return on Cancelation or shutdown or deletion */