// if (authRefreshNeeded)
// if (!refreshConnection())
// return;
SavedSearch enSearch = searches.get(i);
try {
if (enSearch.getUpdateSequenceNum() > 0)
sequence = noteStore.updateSearch(authToken, enSearch);
else {
logger.log(logger.EXTREME, "New saved search found.");
// Look for a tag with the same name. If one is found, we don't need
// to create another one
boolean found = false;
logger.log(logger.EXTREME, "Matching remote saved search names with local");
for (int k=0; k<remoteList.size() && !found && keepRunning; k++) {
if (remoteList.get(k).getName().equalsIgnoreCase(enSearch.getName())) {
enSearch = remoteList.get(k);
found = true;
logger.log(logger.EXTREME, "Matching saved search found");
sequence = enSearch.getUpdateSequenceNum();
}
}
String oldGuid = enSearch.getGuid();
if (!found)
enSearch = noteStore.createSearch(authToken, enSearch);
sequence = enSearch.getUpdateSequenceNum();
logger.log(logger.EXTREME, "Updating tag guid in local database");
conn.getSavedSearchTable().updateSavedSearchGuid(oldGuid, enSearch.getGuid());
}
logger.log(logger.EXTREME, "Updating tag sequence in local database");
conn.getSavedSearchTable().updateSavedSearchSequence(enSearch.getGuid(), sequence);
logger.log(logger.EXTREME, "Resetting tag dirty flag");
conn.getSavedSearchTable().resetDirtyFlag(enSearch.getGuid());
logger.log(logger.EXTREME, "Emitting sequence number to the main thread.");
updateSequenceNumber = sequence;
conn.getSyncTable().setUpdateSequenceNumber(updateSequenceNumber);
} catch (EDAMUserException e) {
logger.log(logger.LOW, "*** EDAM User Excepton syncLocalTags");