this.statusId = statusId;
}
static public void fetchForAccount(Long accountId) {
Account account = Account.findById(accountId);
if (account != null) {
// FIXME CLA simple API quota management
boolean fetch = true;
if (account.lastFetched != null) {
DateTime lastFetch = new DateTime(account.lastFetched);
int delay = Minutes.minutesBetween(lastFetch, new DateTime()).getMinutes();
if (delay < FETCH_PERIOD) {
fetch = false;
Logger.info("Fetch timeline for %s on %s : already done %d minutes ago (< %d configured period)", account.member, account.provider, delay, FETCH_PERIOD);
}
}
if (fetch) {
Logger.info("Fetch timeline for %s on %s", account.member, account.provider);
List<StatusActivity> statuses = account.fetchActivities();
if (!statuses.isEmpty()) {
// Memorizing most recent id
Collections.sort(statuses);
account.lastStatusId = statuses.get(0).statusId;
account.save();
account.enhance(statuses);
}
for (StatusActivity status : statuses) {
boolean add = true;
// Google hack : workaround for lack of "since" parameter in API, returning already fetched statuses.