private int pullChanged(Resource[] resourcesToUpdate) throws URISyntaxException, LocalStorageException, IOException, HttpException, DavException { int count = 0; Log.i(TAG, "Fetching " + resourcesToUpdate.length + " updated remote resource(s)"); for (Resource[] resources : ArrayUtils.partition(resourcesToUpdate, MAX_MULTIGET_RESOURCES)) for (Resource res : remote.multiGet(resources)) { Log.i(TAG, "Updating " + res.getName()); local.updateByRemoteName(res); local.commit(); count++; } return count; }
private int pullNew(Resource[] resourcesToAdd) throws URISyntaxException, LocalStorageException, IOException, HttpException, DavException { int count = 0; Log.i(TAG, "Fetching " + resourcesToAdd.length + " new remote resource(s)"); for (Resource[] resources : ArrayUtils.partition(resourcesToAdd, MAX_MULTIGET_RESOURCES)) for (Resource res : remote.multiGet(resources)) { Log.d(TAG, "Adding " + res.getName()); local.add(res); local.commit(); count++; } return count; }