private WorklogChangedSincePage<Worklog> createChangePage(final Long since, final SortedSet<Worklog> result, final boolean last) { final Worklog lastWorklog = getLast(result, null); final long until = lastWorklog != null ? lastWorklog.getUpdated().getTime() : since; return new WorklogChangedSincePage<>(since, until, new ArrayList<>(result), last); }
@Override public WorklogChangedSincePage<DeletedWorklog> getWorklogsDeletedSince(final ApplicationUser user, final Long sinceInMilliseconds) { if (user == null) { return new WorklogChangedSincePage<>(sinceInMilliseconds, sinceInMilliseconds, Collections.<DeletedWorklog>emptyList(), true); } List<DeletedWorklog> worklogs = worklogManager.getWorklogsDeletedSince(sinceInMilliseconds); final DeletedWorklog lastDeletedWorklog = getLast(worklogs, null); long until = lastDeletedWorklog != null ? lastDeletedWorklog.getDeletionTime().getTime() : sinceInMilliseconds; boolean isLastPage = worklogs.size() < WORKLOG_UPDATE_DATA_PAGE_SIZE; return new WorklogChangedSincePage<>(sinceInMilliseconds, until, worklogs, isLastPage); }