@Override public JSONArray startFetch(SyncManager syncManager, long maxTimeStamp) throws IOException, JSONException { String queryToRun = maxTimeStamp > 0 ? SoqlSyncDownTarget.addFilterForReSync(getQuery(), maxTimeStamp) : getQuery(); syncManager .getRestClient() .sendSync( RestRequest.getRequestForResources( syncManager.apiVersion)); // cheap call to refresh session RestRequest request = buildQueryRequest(syncManager.getRestClient().getAuthToken(), queryToRun); RestResponse response = syncManager.sendSyncWithSmartSyncUserAgent(request); JSONArray records = parseSoapResponse(response); return records; }
@Override public JSONArray continueFetch(SyncManager syncManager) throws IOException, JSONException { if (queryLocator == null) { return null; } RestRequest request = buildQueryMoreRequest(syncManager.getRestClient().getAuthToken(), queryLocator); RestResponse response = syncManager.sendSyncWithSmartSyncUserAgent(request); JSONArray records = parseSoapResponse(response); return records; }